Geo::GDAL 1.9
Classes

Geo::GDAL Class Reference

Inheritance diagram for Geo::GDAL:
Inheritance graph
[legend]

List of all members.

Classes

class  AsyncReader
class  Band
class  ColorTable
class  Const
class  Dataset
class  Driver
class  GCP
class  MajorObject
class  RasterAttributeTable
class  Transformer

Public Functions

list ReadDir (scalar dir)
list Stat (scalar filename)
 Unlink (scalar filename)
scalar VSIFOpenL (scalar filename, scalar mode)
 VSIFCloseL (scalar file)
scalar VSIFWriteL (scalar scalar, scalar file)
scalar VSIFReadL (scalar count, scalar file)
scalar VersionInfo (scalar request= 'VERSION_NUM')
 PushFinderLocation (scalar path)
 PopFinderLocation ()
 FinderClean ()
scalar FindFile (scalar class, scalar basename)
 SetConfigOption (scalar key, scalar value)
scalar GetConfigOption (scalar key, scalar default)
listref GCPsToGeoTransform (listref GCPs, scalar ApproxOK=1)
scalar GetCacheMax ()
 SetCacheMax (scalar Bytes)
scalar GetCacheUsed ()
scalar GetDataTypeSize (scalar GDALDataType)
list DataTypeValueRange (scalar DataType)
scalar DataTypeIsComplex (scalar GDALDataType)
scalar DecToDMS (scalar angle, scalar axis, scalar precision=2)
scalar PackedDMSToDec (scalar packed)
scalar DecToPackedDMS (scalar dec)
scalar NodeType (scalar type)
listref ParseXMLString (scalar XML)
list NodeData (scalar node)
list Children (scalar node)
list Child (scalar node, scalar i)
scalar SerializeXMLTree (listref XMLTree)
list Drivers ()
scalar GetDriverCount ()
Geo::GDAL::Driver Driver (scalar driver)
Geo::GDAL::Driver GetDriverByName (scalar ShortName)
Geo::GDAL::Driver IdentifyDriver (scalar name, scalar siblings)
 ComputeMedianCutPCT (scalar red, scalar green, scalar blue, scalar num_colors, scalar colors, scalar callback, scalar callback_data)
 DitherRGB2PCT (scalar red, scalar green, scalar blue, scalar target, scalar colors, scalar callback, scalar callback_data)
 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, scalar callback, scalar callback_data)
Geo::GDAL::Dataset AutoCreateWarpedVRT (Geo::GDAL::Dataset src, scalar src_wkt=undef, scalar dst_wkt=undef, scalar ResampleAlg='NearestNeighbour', scalar maxerror=0.0)
 ComputeProximity (Geo::GDAL::Band src, Geo::GDAL::Band proximity, hashref options, scalar callback, scalar callback_data)
 RasterizeLayer (Geo::GDAL::Dataset ds, listref bands, Geo::OGR::Layer layer, scalar transformer, scalar arg, listref burn_values, hashref options, scalar callback, scalar callback_data)
 Polygonize (Geo::GDAL::Band src, Geo::GDAL::Band mask, Geo::OGR::Layer out, scalar PixValField, hashref options, scalar callback, scalar callback_data)
 SieveFilter (Geo::GDAL::Band src, Geo::GDAL::Band mask, Geo::GDAL::Band dst, scalar threshold, scalar connectedness, hashref options, scalar callback, scalar callback_data)
 RegenerateOverviews (Geo::GDAL::Band src, listref overviews, scalar resampling, scalar callback, scalar callback_data)
 RegenerateOverview (Geo::GDAL::Band src, Geo::GDAL::Band overview, scalar resampling, scalar callback, scalar callback_data)
listref GeneralCmdLineProcessor (listref argv, scalar options=0)
scalar PackCharacter (scalar DataType)
Geo::GDAL::Dataset Open (scalar name, scalar access='ReadOnly')
Geo::GDAL::Dataset OpenShared (scalar name, scalar access='ReadOnly')
scalar GetDataTypeName (scalar GDALDataType)
scalar GetDataTypeByName (scalar GDALDataType)
scalar GetColorInterpretationName (scalar ColorInterpretation)
scalar GetPaletteInterpretationName (scalar PaletteInterpretation)

Member Function Documentation

Geo::GDAL::Dataset Geo::GDAL::AutoCreateWarpedVRT ( Geo::GDAL::Dataset  src,
scalar  src_wkt = undef,
scalar  dst_wkt = undef,
scalar  ResampleAlg = 'NearestNeighbour',
scalar  maxerror = 0.0 
)
Parameters:
src
src_wktA WKT string.
dst_wktA WKT string.
ResampleAlgone of 'NearestNeighbour', 'Bilinear', 'Cubic', or 'CubicSpline'.
maxerror
Returns:
a new Geo::GDAL::Dataset object

Documentation for GDAL warper

list Geo::GDAL::Child ( scalar  node,
scalar  i 
)
Parameters:
node
i0 .. number of children - 1
Returns:
list Geo::GDAL::Children ( scalar  node)
Parameters:
node
Returns:
Geo::GDAL::ComputeMedianCutPCT ( scalar  red,
scalar  green,
scalar  blue,
scalar  num_colors,
scalar  colors,
scalar  callback,
scalar  callback_data 
)

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
callback[optional] a reference to a subroutine, which will be called with parameters (number progress, string msg, callback_data)
callback_data[optional]

Documentation for GDAL algorithms

Geo::GDAL::ComputeProximity ( Geo::GDAL::Band  src,
Geo::GDAL::Band  proximity,
hashref  options,
scalar  callback,
scalar  callback_data 
)
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.
callback[optional] a reference to a subroutine, which will be called with parameters (number progress, string msg, callback_data)
callback_data[optional]

Documentation for GDAL algorithms

scalar Geo::GDAL::DataTypeIsComplex ( scalar  GDALDataType)
Parameters:
GDALDataTypeAn integer (one of keys of Geo::GDAL::TYPE_INT2STRING).
Returns:
true if the data type is a complex number.
list Geo::GDAL::DataTypeValueRange ( scalar  DataType)
Parameters:
DataTypeData type as string (one of Byte UInt16 Int16 UInt32 Int32 Float32 Float64 CInt16 CInt32 CFloat32 CFloat64).
Returns:
the minimum, maximum range of the data type.
scalar Geo::GDAL::DecToDMS ( scalar  angle,
scalar  axis,
scalar  precision = 2 
)

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
scalar Geo::GDAL::DecToPackedDMS ( scalar  dec)
Parameters:
decDecimal degrees
Returns:
packed DMS, i.e., a number DDDMMMSSS.SS
Geo::GDAL::DitherRGB2PCT ( scalar  red,
scalar  green,
scalar  blue,
scalar  target,
scalar  colors,
scalar  callback,
scalar  callback_data 
)

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
callback[optional] a reference to a subroutine, which will be called with parameters (number progress, string msg, callback_data)
callback_data[optional]

Documentation for GDAL algorithms

Create a driver object for the internal GDAL driver.

Note:
a.k.a. GetDriver
Parameters:
driverThe name or number of the driver.
Returns:
a new Geo::GDAL::Driver object
list Geo::GDAL::Drivers ( )

An example:

use Geo::GDAL;
for my $driver (Geo::GDAL::Drivers) {
   print $driver->{ShortName},"\n";
}

Prints short names of all available GDAL raster drivers.

Returns:
all GDAL raster driver objects in a list.
Geo::GDAL::FinderClean ( )

Clear the set of support file search paths.

scalar Geo::GDAL::FindFile ( scalar  class,
scalar  basename 
)

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.
listref Geo::GDAL::GCPsToGeoTransform ( listref  GCPs,
scalar  ApproxOK = 1 
)

Compute transformation coefficients from a set of Geo::GDAL::GCP objects The geo transformation has the form

x = a + column * b + row * c
y = d + column * e + row * f

where
(column,row) is the location in pixel coordinates
(x,y) is the location in projection coordinates

Parameters:
GCPsA set of Geo::GDAL::GCP objects.
ApproxOKMinimize the error in the coefficient.
Returns:
[$a, $b, $c, $d, $e, $f]
listref Geo::GDAL::GeneralCmdLineProcessor ( listref  argv,
scalar  options = 0 
)
Parameters:
argv
optionsinteger
Returns:
arrayref
scalar Geo::GDAL::GetCacheMax ( )
Returns:
maximum amount of memory (as bytes) for caching within GDAL.
scalar Geo::GDAL::GetCacheUsed ( )
Returns:
the amount of memory currently used for caching within GDAL.
scalar Geo::GDAL::GetColorInterpretationName ( scalar  ColorInterpretation)
Deprecated:
use string names
Parameters:
ColorInterpretation
Returns:
scalar Geo::GDAL::GetConfigOption ( scalar  key,
scalar  default 
)
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.
scalar Geo::GDAL::GetDataTypeByName ( scalar  GDALDataType)
Deprecated:
use string names
Parameters:
GDALDataType
Returns:
scalar Geo::GDAL::GetDataTypeName ( scalar  GDALDataType)
Deprecated:
use string names
Parameters:
GDALDataType
Returns:
scalar Geo::GDAL::GetDataTypeSize ( scalar  GDALDataType)
Parameters:
GDALDataTypeAn integer (one of keys of Geo::GDAL::TYPE_INT2STRING).
Returns:
the size as the number of bits.
Geo::GDAL::Driver Geo::GDAL::GetDriverByName ( scalar  ShortName)
Parameters:
ShortNameA short name of the driver.
Returns:
a new Geo::GDAL::Driver object
scalar Geo::GDAL::GetDriverCount ( )
Returns:
the number of available GDAL raster drivers.
scalar Geo::GDAL::GetPaletteInterpretationName ( scalar  PaletteInterpretation)
Deprecated:
use string names
Parameters:
PaletteInterpretation
Returns:
Geo::GDAL::Driver Geo::GDAL::IdentifyDriver ( scalar  name,
scalar  siblings 
)
Parameters:
nameA dataset path.
siblings[optional] A list of names of files in the directory specified by name.
Returns:
a new Geo::GDAL::Driver object
list Geo::GDAL::NodeData ( scalar  node)
Parameters:
node
Returns:
($NodeType, $value)
scalar Geo::GDAL::NodeType ( scalar  type)

Convert between integer and string expressions of CPLXMLNodeTypes

Parameters:
type
Returns:
type
Geo::GDAL::Dataset Geo::GDAL::Open ( scalar  name,
scalar  access = 'ReadOnly' 
)

An example

use Geo::GDAL;
$ds = Geo::GDAL::Open('existing.tiff', 'Update');
Parameters:
name
accesseither 'ReadOnly' or 'Update'
Returns:
a new Geo::GDAL::Dataset object

Reimplemented in Geo::GDAL::Dataset.

Geo::GDAL::Dataset Geo::GDAL::OpenShared ( scalar  name,
scalar  access = 'ReadOnly' 
)
Parameters:
name
accesseither 'ReadOnly' or 'Update'
Returns:
a new Geo::GDAL::Dataset object

Reimplemented in Geo::GDAL::Dataset.

scalar Geo::GDAL::PackCharacter ( scalar  DataType)

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:
DataTypeGDAL data type value, typically from $band->{DataType}
Returns:
character which can be used in Perl's pack and unpack
scalar Geo::GDAL::PackedDMSToDec ( scalar  packed)
Parameters:
packedDMS as a number DDDMMMSSS.SS
Returns:
decimal degrees
listref Geo::GDAL::ParseXMLString ( scalar  XML)

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
Geo::GDAL::Polygonize ( Geo::GDAL::Band  src,
Geo::GDAL::Band  mask,
Geo::OGR::Layer  out,
scalar  PixValField,
hashref  options,
scalar  callback,
scalar  callback_data 
)
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.
callback[optional] a reference to a subroutine, which will be called with parameters (number progress, string msg, callback_data)
callback_data[optional]

Documentation for GDAL algorithms

Geo::GDAL::PopFinderLocation ( )

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

Geo::GDAL::PushFinderLocation ( scalar  path)

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

Geo::GDAL::RasterizeLayer ( Geo::GDAL::Dataset  ds,
listref  bands,
Geo::OGR::Layer  layer,
scalar  transformer,
scalar  arg,
listref  burn_values,
hashref  options,
scalar  callback,
scalar  callback_data 
)
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.
callback[optional] a reference to a subroutine, which will be called with parameters (number progress, string msg, callback_data)
callback_data[optional]

Documentation for GDAL algorithms

list Geo::GDAL::ReadDir ( scalar  dir)
Returns:
Contents of the directory.
Geo::GDAL::RegenerateOverview ( Geo::GDAL::Band  src,
Geo::GDAL::Band  overview,
scalar  resampling,
scalar  callback,
scalar  callback_data 
)
Parameters:
src
overview
resampling'NEAREST', 'AVERAGE', or 'GAUSS'
callback[optional] a reference to a subroutine, which will be called with parameters (number progress, string msg, callback_data)
callback_data[optional]
Geo::GDAL::RegenerateOverviews ( Geo::GDAL::Band  src,
listref  overviews,
scalar  resampling,
scalar  callback,
scalar  callback_data 
)
Todo:
This is not yet available
Parameters:
src
overviewsA list of Geo::GDAL::Band's for the overviews.
resampling'NEAREST', 'AVERAGE', or 'GAUSS'
callback[optional] a reference to a subroutine, which will be called with parameters (number progress, string msg, callback_data)
callback_data[optional]
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,
scalar  callback,
scalar  callback_data 
)
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.
callback[optional] a reference to a subroutine, which will be called with parameters (number progress, string msg, callback_data). Reprojection is terminated if the progress function returns 0.
callback_data[optional]

Documentation for GDAL warper

scalar Geo::GDAL::SerializeXMLTree ( listref  XMLTree)
Parameters:
XMLTree
Returns:
XML
Geo::GDAL::SetCacheMax ( scalar  Bytes)
Parameters:
BytesNew maximum amount of memory for caching within GDAL.
Geo::GDAL::SetConfigOption ( scalar  key,
scalar  value 
)
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.
Geo::GDAL::SieveFilter ( Geo::GDAL::Band  src,
Geo::GDAL::Band  mask,
Geo::GDAL::Band  dst,
scalar  threshold,
scalar  connectedness,
hashref  options,
scalar  callback,
scalar  callback_data 
)

Removes small raster polygons.

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

Documentation for GDAL algorithms

list Geo::GDAL::Stat ( scalar  filename)
Returns:
($filemode, $filesize). filemode is f for a plain file, d for a directory, l for a symbolic link, p for a named pipe (FIFO), S for a socket, b for a block special file, and c for a character special file.
Geo::GDAL::Unlink ( scalar  filename)
Parameters:
filenameThe file to delete.
Returns:
0 on success and -1 on an error.
scalar Geo::GDAL::VersionInfo ( scalar  request = 'VERSION_NUM')
Parameters:
requestA string specifying the request. Currently either "VERSION_NUM", "RELEASE_DATE", "RELEASE_NAME", or "--version". Default is "VERSION_NUM".
Returns:
Requested information.
Geo::GDAL::VSIFCloseL ( scalar  file)
Parameters:
fileThe file handle.
scalar Geo::GDAL::VSIFOpenL ( scalar  filename,
scalar  mode 
)
Parameters:
filenameName of the file to open. For example "/vsimem/x".
modeAccess mode. 'r', 'r+', 'w', etc.
Returns:
A file handle on success.
scalar Geo::GDAL::VSIFReadL ( scalar  count,
scalar  file 
)
Parameters:
countThe number of bytes to read from the file.
fileThe file handle.
Returns:
A byte string.
scalar Geo::GDAL::VSIFWriteL ( scalar  scalar,
scalar  file 
)
Parameters:
scalarThe byte string to write to the file.
fileThe file handle.
Returns:
Number of bytes written into the file.

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