Geo::GDAL  2.0
Geo::GDAL Class Reference

GDAL utility functions and a root class for raster classes. More...

+ Inheritance diagram for Geo::GDAL:

Classes

class  AsyncReader
 Enable asynchronous requests. More...
 
class  Band
 A raster band. More...
 
class  ColorTable
 A color table in a raster band. More...
 
class  Dataset
 A set of associated raster bands. More...
 
class  Driver
 A raster format driver. More...
 
class  GCP
 A ground control point for georeferencing images. More...
 
class  GeoTransform
 An array of affine transformation coefficients. More...
 
class  MajorObject
 An object, which holds meta data. More...
 
class  RasterAttributeTable
 An attribute table in a raster band. More...
 
class  Transformer
 This class is not yet documented for the GDAL Perl bindings. More...
 
class  VSIF
 A GDAL virtual file system. More...
 

Public Member Functions

public list AccessTypes ()
 
public Geo::GDAL::Dataset AutoCreateWarpedVRT (Geo::GDAL::Dataset src, Geo::OSR::SpatialReference src_srs=undef, Geo::OSR::SpatialReference dst_srs=undef, scalar ResampleAlg='NearestNeighbour', scalar maxerror=0.0)
 
public method CPLBinaryToHex ()
 
public method CPLHexToBinary ()
 
public list Child (scalar node, scalar i)
 
public list Children (scalar node)
 
public method ComputeMedianCutPCT (Geo::GDAL::Band red, Geo::GDAL::Band green, Geo::GDAL::Band blue, scalar num_colors, scalar colors, subref progress, scalar progress_data)
 
public method ComputeProximity (Geo::GDAL::Band src, Geo::GDAL::Band proximity, hashref options, subref progress, scalar progress_data)
 
public scalar DataTypeIsComplex (scalar DataType)
 
public list DataTypeValueRange (scalar DataType)
 
public list DataTypes ()
 
public method Debug ()
 
public scalar DecToDMS (scalar angle, scalar axis, scalar precision=2)
 
public scalar DecToPackedDMS (scalar dec)
 
public method DitherRGB2PCT (scalar red, scalar green, scalar blue, scalar target, scalar colors, subref progress, scalar progress_data)
 
public method EscapeString ()
 
public scalar FindFile (scalar class, scalar basename)
 
public method FinderClean ()
 
public method GOA2GetAccessToken ()
 
public method GOA2GetAuthorizationURL ()
 
public method GOA2GetRefreshToken ()
 
public scalar GetCacheMax ()
 
public scalar GetCacheUsed ()
 
public scalar GetConfigOption (scalar key, scalar default)
 
public scalar GetDataTypeSize (scalar DataType)
 
public Geo::GDAL::Driver GetDriver (scalar name)
 
public list GetDriverNames ()
 
public method GetJPEG2000StructureAsString ()
 
public Geo::GDAL::Driver IdentifyDriver (scalar path, scalar siblings)
 
public list NodeData (scalar node)
 
public scalar NodeType (scalar type)
 
public list NodeTypes ()
 
public Geo::GDAL::Dataset Open (scalar name, scalar access= 'ReadOnly')
 
public Geo::GDAL::Dataset OpenEx (scalar name, scalar open_flags=0, array reference allowed_drivers=undef, array reference open_options=undef, array reference sibling_files=undef)
 
public Geo::GDAL::Dataset OpenShared (scalar name, scalar access= 'ReadOnly')
 
public scalar PackCharacter (scalar DataType)
 
public scalar PackedDMSToDec (scalar packed)
 
public array reference ParseXMLString (scalar XML)
 
public method Polygonize (Geo::GDAL::Band src, Geo::GDAL::Band mask, Geo::OGR::Layer out, scalar PixValField, hashref options, subref progress, scalar progress_data)
 
public method PopFinderLocation ()
 
public method PushFinderLocation (scalar path)
 
public list RIOResamplingTypes ()
 
public method RasterizeLayer (Geo::GDAL::Dataset ds, arrayref bands, Geo::OGR::Layer layer, scalar transformer, scalar arg, arrayref burn_values, hashref options, subref progress, scalar progress_data)
 
public method ReprojectImage (scalar src_ds, scalar dst_ds, scalar src_wkt=undef, scalar dst_wkt=undef, scalar ResampleAlg='NearestNeighbour', scalar WarpMemoryLimit=0, scalar maxerror=0.0, subref progress, scalar progress_data)
 
public list ResamplingTypes ()
 
public scalar SerializeXMLTree (arrayref XMLTree)
 
public method SetCacheMax (scalar Bytes)
 
public method SetConfigOption (scalar key, scalar value)
 
public method SieveFilter (Geo::GDAL::Band src, Geo::GDAL::Band mask, Geo::GDAL::Band dst, scalar threshold, scalar connectedness, hashref options, subref progress, scalar progress_data)
 
public scalar VersionInfo (scalar request= 'VERSION_NUM')
 

Detailed Description

GDAL utility functions and a root class for raster classes.

Geo::GDAL wraps many GDAL utility functions and acts as a root class for all GDAL raster classes. A "raster" is a dataset, whose core is a rectagular grid or grids of pixels, called a "band" in GDAL. Each pixel contains a numeric value of a specific data type

Definition at line 14 of file all.pm.

Member Function Documentation

public list Geo::GDAL::AccessTypes ( )

Class method.

Returns
a list of GDAL data set open modes. These are currently: ReadOnly, and Update.
Code:
click to view
public Geo::GDAL::Dataset Geo::GDAL::AutoCreateWarpedVRT ( Geo::GDAL::Dataset  src,
Geo::OSR::SpatialReference  src_srs = undef,
Geo::OSR::SpatialReference  dst_srs = undef,
scalar  ResampleAlg = 'NearestNeighbour',
scalar  maxerror = 0.0 
)

Class method.

Parameters
src
src_srssource projection.
dst_srsdestination projection.
ResampleAlgone of Geo::GDAL::ResamplingTypes().
maxerror
Returns
a new Geo::GDAL::Dataset object

Documentation for GDAL warper

Code:
click to view
public list Geo::GDAL::Child ( scalar  node,
scalar  i 
)

Class method.

Parameters
node
i0 .. number of children - 1
Returns
Code:
click to view
public list Geo::GDAL::Children ( scalar  node)

Class method.

Parameters
node
Returns
Code:
click to view
public method Geo::GDAL::ComputeMedianCutPCT ( Geo::GDAL::Band  red,
Geo::GDAL::Band  green,
Geo::GDAL::Band  blue,
scalar  num_colors,
scalar  colors,
subref  progress,
scalar  progress_data 
)

Class method. Compute an "optimal" color table for a three band image.

Parameters
reda Geo::GDAL::Band object
greena Geo::GDAL::Band object
bluea Geo::GDAL::Band object
num_colorsthe desired number of colors
colorsan empty Geo::GDAL::ColorTable object
progress[optional] a reference to a subroutine, which will be called with parameters (number progress, string msg, progress_data)
progress_data[optional]

Documentation for GDAL algorithms

Code:
click to view
public method Geo::GDAL::ComputeProximity ( Geo::GDAL::Band  src,
Geo::GDAL::Band  proximity,
hashref  options,
subref  progress,
scalar  progress_data 
)

Class method.

Parameters
srcThe raster from which the proximities are computed from.
proximityThe raster to which the proximities are computed to.
optionsOptions. Supported key, value pairs are
  • VALUES => n[,n]* A list of target pixel values to measure the distance from. If this option is not provided proximity will be computed from non-zero pixel values. Currently pixel values are internally processed as integers.
  • DISTUNITS => PIXEL|GEO Indicates whether distances will be computed in pixel units or in georeferenced units. The default is pixel units. This also determines the interpretation of MAXDIST.
  • MAXDIST => n The maximum distance to search. Proximity distances greater than this value will not be computed. Instead output pixels will be set to a nodata value.
  • NODATA => n The NODATA value to use on the output band for pixels that are beyond MAXDIST. If not provided, the hProximityBand will be queried for a nodata value. If one is not found, 65535 will be used.
  • FIXED_BUF_VAL => n If this option is set, all pixels within the MAXDIST threadhold are set to this fixed value instead of to a proximity distance.
progress[optional] a reference to a subroutine, which will be called with parameters (number progress, string msg, progress_data)
progress_data[optional]

Documentation for GDAL algorithms

Code:
click to view
public method Geo::GDAL::CPLBinaryToHex ( )
Code:
click to view
public method Geo::GDAL::CPLHexToBinary ( )
Code:
click to view
public scalar Geo::GDAL::DataTypeIsComplex ( scalar  DataType)

Class method.

Parameters
DataTypeA GDAL pixel data type (one of those listed by Geo::GDAL::DataTypes).
Returns
true if the data type is a complex number.
Code:
click to view
public list Geo::GDAL::DataTypes ( )

Class method.

Returns
a list of GDAL pixel data types. These are currently: Byte, CFloat32, CFloat64, CInt16, CInt32, Float32, Float64, Int16, Int32, UInt16, UInt32, and Unknown.
Code:
click to view
public list Geo::GDAL::DataTypeValueRange ( scalar  DataType)

Class method.

Parameters
DataTypeData type (one of those listed by Geo::GDAL::DataTypes).
Note
Some returned values are inaccurate.
Returns
the minimum, maximum range of the data type.
Code:
click to view
public method Geo::GDAL::Debug ( )
Code:
click to view
public scalar Geo::GDAL::DecToDMS ( scalar  angle,
scalar  axis,
scalar  precision = 2 
)

Class method. Convert decimal degrees to degrees, minutes, and seconds string

Parameters
angleA number
axisA string specifying latitude or longitude ('Long').
precision
Returns
a string nndnn'nn.nn'"L where n is a number and L is either N or E
Code:
click to view
public scalar Geo::GDAL::DecToPackedDMS ( scalar  dec)

Class method.

Parameters
decDecimal degrees
Returns
packed DMS, i.e., a number DDDMMMSSS.SS
Code:
click to view
public method Geo::GDAL::DitherRGB2PCT ( scalar  red,
scalar  green,
scalar  blue,
scalar  target,
scalar  colors,
subref  progress,
scalar  progress_data 
)

Class method. Dither a three band image into one band using a color table.

Parameters
reda Geo::GDAL::Band object
greena Geo::GDAL::Band object
bluea Geo::GDAL::Band object
targeta Geo::GDAL::Band object
colorsa Geo::GDAL::ColorTable object
progress[optional] a reference to a subroutine, which will be called with parameters (number progress, string msg, progress_data)
progress_data[optional]

Documentation for GDAL algorithms

Code:
click to view
public method Geo::GDAL::EscapeString ( )
Code:
click to view
public method Geo::GDAL::FinderClean ( )

Class method. Clear the set of support file search paths.

Code:
click to view
public scalar Geo::GDAL::FindFile ( scalar  class,
scalar  basename 
)

Class method. Search for GDAL support files.

An example:

use Geo::GDAL;
$a = Geo::GDAL::FindFile('gdal', 'pcs.csv');
print STDERR "$a\n";

Prints (for example):

c:\msys\1.0\local\share\gdal\pcs.csv
Parameters
classThe class of files to search for. For example 'gdal'.
basenameThe basename of the file to search for. For example 'pcs.csv'.
Returns
the path to the searched file or undef.
Code:
click to view
public scalar Geo::GDAL::GetCacheMax ( )

Class method.

Returns
maximum amount of memory (as bytes) for caching within GDAL.
Code:
click to view
public scalar Geo::GDAL::GetCacheUsed ( )

Class method.

Returns
the amount of memory currently used for caching within GDAL.
Code:
click to view
public scalar Geo::GDAL::GetConfigOption ( scalar  key,
scalar  default 
)

Class method.

Parameters
keyA GDAL config option.
defaultA default value for the option.
Returns
the value of the GDAL config option or the value of the default parameter.
Code:
click to view
public scalar Geo::GDAL::GetDataTypeSize ( scalar  DataType)

Class method.

Parameters
DataTypeA GDAL pixel data type (one of those listed by Geo::GDAL::DataTypes).
Returns
the size as the number of bits.
Code:
click to view
public Geo::GDAL::Driver Geo::GDAL::GetDriver ( scalar  name)

Class method. Create a driver object for the internal GDAL driver.

Parameters
namethe (short) name of the driver.
Returns
a Geo::GDAL::Driver object, which represents the internal driver.
Code:
click to view
public list Geo::GDAL::GetDriverNames ( )

Class method.

Returns
a list of the named of all (available and registered) GDAL raster drivers.
Code:
click to view
public method Geo::GDAL::GetJPEG2000StructureAsString ( )
Code:
click to view
public method Geo::GDAL::GOA2GetAccessToken ( )
Code:
click to view
public method Geo::GDAL::GOA2GetAuthorizationURL ( )
Code:
click to view
public method Geo::GDAL::GOA2GetRefreshToken ( )
Code:
click to view
public Geo::GDAL::Driver Geo::GDAL::IdentifyDriver ( scalar  path,
scalar  siblings 
)

Class method.

Parameters
patha dataset path.
siblings[optional] A list of names of files in the directory specified by the path.
Returns
a Geo::GDAL::Driver object, which represents an internal driver.
Code:
click to view
public list Geo::GDAL::NodeData ( scalar  node)

Class method.

Parameters
node
Returns
($NodeType, $value)
Code:
click to view
public scalar Geo::GDAL::NodeType ( scalar  type)

Class method. Convert between integer and string expressions of CPLXMLNodeTypes

Parameters
type(as integer)
Returns
type (as string)
Code:
click to view
public list Geo::GDAL::NodeTypes ( )

Class method.

Returns
a list of GDAL XML parser node types. These are currently: Attribute, Comment, Element, Literal, and Text.
Code:
click to view
public Geo::GDAL::Dataset Geo::GDAL::Open ( scalar  name,
scalar  access = 'ReadOnly' 
)

Class method. An example

use Geo::GDAL;
$ds = Geo::GDAL::Open('existing.tiff', 'Update');
Parameters
name
accessAccess type (one of those listed by Geo::GDAL::AccessTypes).
Returns
a new Geo::GDAL::Dataset object.
Code:
click to view
public Geo::GDAL::Dataset Geo::GDAL::OpenEx ( scalar  name,
scalar  open_flags = 0,
array reference  allowed_drivers = undef,
array reference  open_options = undef,
array reference  sibling_files = undef 
)

Class method.

Returns
a new Geo::GDAL::Dataset object.
Code:
click to view
public Geo::GDAL::Dataset Geo::GDAL::OpenShared ( scalar  name,
scalar  access = 'ReadOnly' 
)

Class method.

Parameters
name
accessAccess type (one of those listed by Geo::GDAL::AccessTypes).
Returns
a new Geo::GDAL::Dataset object.
Code:
click to view
public scalar Geo::GDAL::PackCharacter ( scalar  DataType)

Class method. Get the character that is needed for Perl's pack and unpack when they are used with Geo::GDAL::Band::ReadRaster and Geo::GDAL::Band::WriteRaster. Note that Geo::GDAL::Band::ReadTile and Geo::GDAL::Band::WriteTile have simpler interfaces that do not require pack and unpack.

Parameters
DataTypeA GDAL pixel data type (typically from $band->{DataType}).
Returns
a character which can be used in Perl's pack and unpack.
Code:
click to view
public scalar Geo::GDAL::PackedDMSToDec ( scalar  packed)

Class method.

Parameters
packedDMS as a number DDDMMMSSS.SS
Returns
decimal degrees
Code:
click to view
public array reference Geo::GDAL::ParseXMLString ( scalar  XML)

Class method. Parses a given XML into an array of arrays and returns a reference to that. An array in the structure is: (CPLXMLNodeType, value, child, child, ...). CPLXMLNodeType is an integer.

Parameters
XML
Returns
an XMLTree.

Example:

open FILE, "data.xml" or die "Couldn't open file: $!";
my $xml = join("", <FILE>);
close FILE;
my $tree = Geo::GDAL::ParseXMLString($xml);
traverse($tree);
print Geo::GDAL::SerializeXMLTree($tree),"\n";
sub traverse {
. my $node = shift;
. my $type = shift @$node;
. my $data = shift @$node;
. $type = Geo::GDAL::NodeType($type);
. print "$type, $data\n";
. for my $child (@$node) {
. traverse($child);
. }
}
Code:
click to view
public method Geo::GDAL::Polygonize ( Geo::GDAL::Band  src,
Geo::GDAL::Band  mask,
Geo::OGR::Layer  out,
scalar  PixValField,
hashref  options,
subref  progress,
scalar  progress_data 
)

Class method.

Parameters
src
maskAll pixels in the mask band with a value other than zero will be considered suitable for collection as polygons. Must be undef if not used.
out
PixValFieldThe index (or name) of the field in output layer into which the pixel value of the polygon should be written.
optionsNot used.
progress[optional] a reference to a subroutine, which will be called with parameters (number progress, string msg, progress_data)
progress_data[optional]

Documentation for GDAL algorithms

Code:
click to view
public method Geo::GDAL::PopFinderLocation ( )

Class method. Remove the latest addition from the set of support file search paths.

Code:
click to view
public method Geo::GDAL::PushFinderLocation ( scalar  path)

Class method. Add a path to the set of paths from where GDAL support files are sought.

Code:
click to view
public method Geo::GDAL::RasterizeLayer ( Geo::GDAL::Dataset  ds,
arrayref  bands,
Geo::OGR::Layer  layer,
scalar  transformer,
scalar  arg,
arrayref  burn_values,
hashref  options,
subref  progress,
scalar  progress_data 
)

Class method.

Parameters
ds
bandsA reference to a list of bands to be updated.
layer
transformerNot supported, must be undef.
argTransformer argument, must be undef.
burn_valuesValues to be used for burning the geometries. One for each layer.
optionsNot used.
progress[optional] a reference to a subroutine, which will be called with parameters (number progress, string msg, progress_data)
progress_data[optional]

Documentation for GDAL algorithms

Code:
click to view
public method Geo::GDAL::ReprojectImage ( scalar  src_ds,
scalar  dst_ds,
scalar  src_wkt = undef,
scalar  dst_wkt = undef,
scalar  ResampleAlg = 'NearestNeighbour',
scalar  WarpMemoryLimit = 0,
scalar  maxerror = 0.0,
subref  progress,
scalar  progress_data 
)

Class method.

Parameters
src_dsSource dataset.
dst_dsDestination dataset.
src_wktSource projection as a WKT.
dst_wktDestination projection as a WKT.
ResampleAlgOne of NearestNeighbour Bilinear Cubic or CubicSpline.
WarpMemoryLimitThe amount of memory allowed for caching. Default is 0, i.e., no limit.
maxerrorMaximum error measured in input pixels that is allowed in approximating the transformation. Default is 0.0, i.e., exact calculations.
progress[optional] a reference to a subroutine, which will be called with parameters (number progress, string msg, progress_data). Reprojection is terminated if the progress function returns 0.
progress_data[optional]

Documentation for GDAL warper

Code:
click to view
public list Geo::GDAL::ResamplingTypes ( )

Class method.

Returns
a list of GDAL resampling methods.
Code:
click to view
public list Geo::GDAL::RIOResamplingTypes ( )

Class method.

Returns
a list of GDAL raster IO resampling methods.
Code:
click to view
public scalar Geo::GDAL::SerializeXMLTree ( arrayref  XMLTree)

Class method.

Parameters
XMLTree
Returns
XML
Code:
click to view
public method Geo::GDAL::SetCacheMax ( scalar  Bytes)

Class method.

Parameters
BytesNew maximum amount of memory for caching within GDAL.
Code:
click to view
public method Geo::GDAL::SetConfigOption ( scalar  key,
scalar  value 
)

Class method.

Parameters
keyA GDAL config option. Possible values include 'GDAL_FORCE_CACHING', 'USE_RRD', GDAL_DATA', 'GDAL_SKIP', 'GDAL_DRIVER_PATH', 'GDAL_IGNORE_AXIS_ORIENTATION', 'GMLJP2OVERRIDE', 'GDAL_DISABLE_READDIR_ON_OPEN', 'GDAL_PAM_ENABLED', 'GDAL_PAM_MODE', 'GDAL_PAM_PROXY_DIR', 'GDAL_MAX_DATASET_POOL_SIZE', 'GDAL_FORCE_CACHING', 'GDAL_CACHEMAX', 'GDAL_SWATH_SIZE', 'PROJSO', 'CENTER_LONG', 'OGR_DEBUG_ORGANIZE_POLYGONS', 'OGR_ORGANIZE_POLYGONS', and 'GDAL_JP2K_ALT_OFFSETVECTOR_ORDER'. Consult the GDAL main documentation for the semantics of config options.
valueA value for the option, typically 'YES', 'NO', undef, a path, or a filename.
Code:
click to view
public method Geo::GDAL::SieveFilter ( Geo::GDAL::Band  src,
Geo::GDAL::Band  mask,
Geo::GDAL::Band  dst,
scalar  threshold,
scalar  connectedness,
hashref  options,
subref  progress,
scalar  progress_data 
)

Class method. Removes small raster polygons.

Parameters
src
mask
dst
thresholdAn integer.
connectedness4 or 8
optionsNot used.
progress[optional] a reference to a subroutine, which will be called with parameters (number progress, string msg, progress_data)
progress_data[optional]

Documentation for GDAL algorithms

Code:
click to view
public scalar Geo::GDAL::VersionInfo ( scalar  request = 'VERSION_NUM')

Class method.

Parameters
requestA string specifying the request. Currently either "VERSION_NUM", "RELEASE_DATE", "RELEASE_NAME", or "--version". Default is "VERSION_NUM".
Returns
Requested information.
Code:
click to view

The documentation for this class was generated from the following file: