Geo::GDAL  2.4
Geo::GDAL::Band Class Reference

A raster band.
More...

+ Inheritance diagram for Geo::GDAL::Band:
+ Collaboration diagram for Geo::GDAL::Band:

Public Member Functions

public method AdviseRead ()
 
public Geo::GDAL::RasterAttributeTable AttributeTable (scalar AttributeTable)
 
public list BlockSize ()
 
public list CategoryNames (array names)
 
public scalar Checksum (scalar xoff=0, scalar yoff=0, scalar xsize=undef, scalar ysize=undef)
 
public hashref ClassCounts (scalar classifier, scalar progress=undef, scalar progress_data=undef)
 
public scalar ColorInterpretation (scalar color_interpretation)
 
public method ColorInterpretations ()
 
public Geo::GDAL::ColorTable ColorTable (scalar ColorTable)
 
public method ComputeBandStats (scalar samplestep=1)
 
public method ComputeRasterMinMax (scalar approx_ok=0)
 
public list ComputeStatistics (scalar approx_ok, scalar progress=undef, scalar progress_data=undef)
 
public Geo::OGR::Layer Contours (scalar DataSource, hashref LayerConstructor, scalar ContourInterval, scalar ContourBase, arrayref FixedLevels, scalar NoDataValue, scalar IDField, scalar ElevField, coderef Progress, scalar ProgressData)
 
public method CreateMaskBand (array flags)
 
public scalar DataType ()
 
public Geo::GDAL::Dataset Dataset ()
 
public scalar DeleteNoDataValue ()
 
public Geo::GDAL::Band Distance (hash params)
 
public method Domains ()
 
public method Fill (scalar real_part, scalar imag_part=0.0)
 
public method FillNoData (scalar mask, scalar max_search_dist, scalar smoothing_iterations, scalar options, coderef progress, scalar progress_data)
 
public method FlushCache ()
 
public scalar GetBandNumber ()
 
public method GetBlockSize ()
 
public list GetDefaultHistogram (scalar force=1, coderef progress=undef, scalar progress_data=undef)
 
public list GetHistogram (hash parameters)
 
public Geo::GDAL::Band GetMaskBand ()
 
public list GetMaskFlags ()
 
public scalar GetMaximum ()
 
public scalar GetMinimum ()
 
public Geo::GDAL::Band GetOverview (scalar index)
 
public scalar GetOverviewCount ()
 
public list GetStatistics (scalar approx_ok, scalar force)
 
public method HasArbitraryOverviews ()
 
public list MaskFlags ()
 
public scalar NoDataValue (scalar NoDataValue)
 
public scalar PackCharacter ()
 
public method Piddle (scalar piddle, scalar xoff=0, scalar yoff=0, scalar xsize=< width >, scalar ysize=< height >, scalar xdim, scalar ydim)
 
public Geo::OGR::Layer Polygonize (hash params)
 
public method RasterAttributeTable ()
 
public scalar ReadRaster (hash params)
 
public array reference ReadTile (scalar xoff=0, scalar yoff=0, scalar xsize=< width >, scalar ysize=< height >)
 
public method Reclassify (scalar classifier, scalar progress=undef, scalar progress_data=undef)
 
public method RegenerateOverview (Geo::GDAL::Band overview, scalar resampling, coderef progress, scalar progress_data)
 
public method RegenerateOverviews (arrayref overviews, scalar resampling, coderef progress, scalar progress_data)
 
public method ScaleAndOffset (scalar scale, scalar offset)
 
public list SetDefaultHistogram (scalar min, scalar max, scalar histogram)
 
public method SetStatistics (scalar min, scalar max, scalar mean, scalar stddev)
 
public Geo::GDAL::Band Sieve (hash params)
 
public list Size ()
 
public method Unit (scalar type)
 
public method WriteRaster (hash params)
 
public method WriteTile (scalar data, scalar xoff=0, scalar yoff=0)
 
- Public Member Functions inherited from Geo::GDAL::MajorObject
public scalar Description (scalar description)
 
public method Domains ()
 
public scalar GetDescription ()
 
public hash reference GetMetadata (scalar domain="")
 
public method GetMetadataDomainList ()
 
public hash reference Metadata (hashref metadata=undef, scalar domain= '')
 
public method SetDescription (scalar NewDesc)
 
public method SetMetadata (hashref metadata, scalar domain="")
 
- Public Member Functions inherited from Geo::GDAL
public method ApplyVerticalShiftGrid ()
 
public method BuildVRT ()
 
public method CPLBinaryToHex ()
 
public method CPLHexToBinary ()
 
public method CreatePansharpenedVRT ()
 
public scalar DataTypeIsComplex (scalar DataType)
 
public list DataTypeValueRange (scalar DataType)
 
public list DataTypes ()
 
public scalar DecToDMS (scalar angle, scalar axis, scalar precision=2)
 
public scalar DecToPackedDMS (scalar dec)
 
public method DontUseExceptions ()
 
public Geo::GDAL::Driver Driver (scalar Name)
 
public list DriverNames ()
 
public list Drivers ()
 
public method EscapeString ()
 
public scalar FindFile (scalar basename)
 
public method FinderClean ()
 
public method GOA2GetAccessToken ()
 
public method GOA2GetAuthorizationURL ()
 
public method GOA2GetRefreshToken ()
 
public method GetActualURL ()
 
public scalar GetCacheMax ()
 
public scalar GetCacheUsed ()
 
public scalar GetConfigOption (scalar key)
 
public scalar GetDataTypeSize (scalar DataType)
 
public method GetErrorCounter ()
 
public method GetFileSystemOptions ()
 
public method GetFileSystemsPrefixes ()
 
public method GetJPEG2000StructureAsString ()
 
public method GetSignedURL ()
 
public Geo::GDAL::Driver IdentifyDriver (scalar path, scalar siblings)
 
public method IdentifyDriverEx ()
 
public method MkdirRecursive ()
 
public Geo::GDAL::Dataset Open (hash params)
 
public Geo::GDAL::Dataset OpenEx (hash params)
 
public list OpenFlags ()
 
public scalar PackCharacter (scalar DataType)
 
public scalar PackedDMSToDec (scalar packed)
 
public method PopFinderLocation ()
 
public method PushFinderLocation (scalar path)
 
public list RIOResamplingTypes ()
 
public list ResamplingTypes ()
 
public method RmdirRecursive ()
 
public method SetCacheMax (scalar Bytes)
 
public method SetConfigOption (scalar key, scalar value)
 
public method UseExceptions ()
 
public method VSICurlClearCache ()
 
public method VSIFEofL ()
 
public method VSIFOpenExL ()
 
public method VSIGetLastErrorMsg ()
 
public method VSIGetLastErrorNo ()
 
public scalar VersionInfo (scalar request= 'VERSION_NUM')
 
public scalar errstr ()
 

Public Attributes

scalar XSize
 Object attribute.
scalar (access as $band->{XSize})


 
scalar YSize
 Object attribute.
scalar (access as $band->{YSize})


 

Detailed Description

A raster band.



Definition at line 1379 of file all.dox.

Member Function Documentation

public method Geo::GDAL::Band::AdviseRead ( )


Code:
click to view

public Geo::GDAL::RasterAttributeTable Geo::GDAL::Band::AttributeTable ( scalar  AttributeTable)

Object method.

Parameters
AttributeTable[optional] A Geo::GDAL::RasterAttributeTable object.
Returns
a new Geo::GDAL::RasterAttributeTable object, whose data is
contained within the band.

Code:
click to view

public list Geo::GDAL::Band::BlockSize ( )

Object method.
A.k.a GetBlockSize

Returns
The size of a preferred i/o raster block size as a list
(width, height).

Code:
click to view

public list Geo::GDAL::Band::CategoryNames ( array  names)

Object method.

Parameters
names[optional]
Returns


Code:
click to view

public scalar Geo::GDAL::Band::Checksum ( scalar  xoff = 0,
scalar  yoff = 0,
scalar  xsize = undef,
scalar  ysize = undef 
)

Object method.
Computes a checksum from the raster or a part of it.

Parameters
xoff
yoff
xsize
ysize
Returns
the checksum.

Code:
click to view

public hashref Geo::GDAL::Band::ClassCounts ( scalar  classifier,
scalar  progress = undef,
scalar  progress_data = undef 
)

Object method.
Compute the counts of cell values or number of cell values in ranges.

Note
Classifier is required only for float bands.
NoData values are counted similar to other values when
classifier is not defined for integer rasters.

Parameters
classifierAnonymous array of format [ $comparison,
$classifier ], where $comparison is a string '<', '<=', '>', or '>='
and $classifier is an anonymous array of format [ $value,
$value|$classifier, $value|$classifier ], where $value is a numeric
value against which the reclassified value is compared to. If the
comparison returns true, then the second $value or $classifier is
applied, and if not then the third $value or $classifier.

In the example below, the line is divided into ranges
[-inf..3), [3..5), and [5..inf], i.e., three ranges with class
indexes 0, 1, and 2. Note that the indexes are used as keys for
class counts and not the class values (here 1.0, 2.0, and 3.0),
which are used in Geo::GDAL::Band::Reclassify.
<br>$classifier = [ '<', [5.0, [3.0, 1.0, 2.0], 3.0] ];
<br># Howto create this $classifier from @class_boundaries:
<br>my $classifier = ['<='];
<br>my $tree = [$class_boundaries[0], 0, 1];
<br>for my $i (1 .. $#class_boundaries) {
<br> $tree = [$class_boundaries[$i], [@$tree], $i+1];
<br>}
<br>push @$classifier, $tree;
<br>

Returns
a reference to an anonymous hash, which contains the class
values (indexes) as keys and the number of cells with that value or
in that range as values. If the subroutine is user terminated an
error is raised.

Code:
click to view

public scalar Geo::GDAL::Band::ColorInterpretation ( scalar  color_interpretation)

Object method.

Note
a.k.a. GetRasterColorInterpretation and GetColorInterpretation
(get only and returns an integer), SetRasterColorInterpretation and
SetColorInterpretation (set only and requires an integer)
Parameters
color_interpretation[optional] new color interpretation, one
of Geo::GDAL::Band::ColorInterpretations.
Returns
The color interpretation of this band. One of Geo::GDAL::Band::ColorInterpretations.

Code:
click to view

public method Geo::GDAL::Band::ColorInterpretations ( )

Package subroutine.

Returns
a list of types of color interpretation for raster
bands. These are currently:
AlphaBand, BlackBand, BlueBand, CyanBand, GrayIndex, GreenBand, HueBand, LightnessBand, MagentaBand, PaletteIndex, RedBand, SaturationBand, Undefined, YCbCr_CbBand, YCbCr_CrBand, YCbCr_YBand, and YellowBand.

Code:
click to view

public Geo::GDAL::ColorTable Geo::GDAL::Band::ColorTable ( scalar  ColorTable)

Object method.
Get or set the color table of this band.

Parameters
ColorTable[optional] a Geo::GDAL::ColorTable object
Returns
A new Geo::GDAL::ColorTable object which represents the
internal color table associated with this band. Returns undef this
band does not have an associated color table.

Code:
click to view

public method Geo::GDAL::Band::ComputeBandStats ( scalar  samplestep = 1)

Object method.

Parameters
samplestepthe row increment in computing the statistics.
Note
Returns uncorrected sample standard deviation.

See also Geo::GDAL::Band::ComputeStatistics.
Returns
a list (mean, stddev).

Code:
click to view

public method Geo::GDAL::Band::ComputeRasterMinMax ( scalar  approx_ok = 0)

Object method.

Returns
arrayref MinMax = [min, max]

Code:
click to view

public list Geo::GDAL::Band::ComputeStatistics ( scalar  approx_ok,
scalar  progress = undef,
scalar  progress_data = undef 
)

Object method.

Parameters
approx_okWhether it is allowed to compute the statistics
based on overviews or similar.
Note
Returns uncorrected sample standard deviation.

See also Geo::GDAL::Band::ComputeBandStats.
Returns
a list ($min, $max, $mean, $stddev).

Code:
click to view

public Geo::OGR::Layer Geo::GDAL::Band::Contours ( scalar  DataSource,
hashref  LayerConstructor,
scalar  ContourInterval,
scalar  ContourBase,
arrayref  FixedLevels,
scalar  NoDataValue,
scalar  IDField,
scalar  ElevField,
coderef  Progress,
scalar  ProgressData 
)

Object method.
Generate contours for this raster band. This method can also be used with named parameters.

Note
This method is a wrapper for ContourGenerate.

An example:
<br>use Geo::GDAL;
<br>$dem = Geo::GDAL::Open('dem.gtiff');
<br>$contours = $dem->Band->Contours(ContourInterval => 10, ElevField => 'z');
<br>$n = $contours->GetFeatureCount;
<br>


Parameters
DataSourcea Geo::OGR::DataSource object, default is a Memory data source
LayerConstructordata for Geo::OGR::DataSource::CreateLayer, default is {Name => 'contours'}
ContourIntervaldefault is 100
ContourBasedefault is 0
FixedLevelsa reference to a list of fixed contour levels, default is []
NoDataValuedefault is undef
IDFielddefault is '', i.e., no field (the field is created if this is given)
ElevFielddefault is '', i.e., no field (the field is created if this is given)
progress[optional] a reference to a subroutine, which will
be called with parameters (number progress, string msg, progress_data)
progress_data[optional]
Returns


Code:
click to view

public method Geo::GDAL::Band::CreateMaskBand ( array  flags)

Object method.

Note
May invalidate any previous mask band obtained with Geo::GDAL::Band::GetMaskBand.

Parameters
flagsone or more mask flags. The flags are Geo::GDAL::Band::MaskFlags.

Code:
click to view

Object method.

Returns
The dataset which this band belongs to.

Code:
click to view

public scalar Geo::GDAL::Band::DataType ( )

Object method.

Returns
The data type of this band. One of Geo::GDAL::DataTypes.

Code:
click to view

public scalar Geo::GDAL::Band::DeleteNoDataValue ( )

Object method.

Code:
click to view

public Geo::GDAL::Band Geo::GDAL::Band::Distance ( hash  params)

Object method.
Compute distances to specific cells of this raster.

Parameters
paramsNamed parameters:
- Distance A raster band, into which the distances are computed. If not given, a not given, a new in-memory raster band is created and returned. The data type of the raster can be given in the options.
- Options Hash of options. Options are:
- Values A list of cell values in this band to measure the distance from. If this option is not provided, the distance will be computed to non-zero pixel values. Currently pixel values are internally processed as integers.
- DistUnits=PIXEL|GEO Indicates whether distances will be computed in cells or in georeferenced units. The default is pixel units. This also determines the interpretation of MaxDist.
- MaxDist=n The maximum distance to search. Distances greater than this value will not be computed. Instead output cells will be set to a NoData value.
- NoData=n The NoData value to use on the distance band for cells that are beyond MaxDist. If not provided, the distance band will be queried for a NoData value. If one is not found, 65535 will be used (255 if the type is Byte).
- Use_Input_NoData=YES|NO If this option is set, the NoData value of this band will be respected. Leaving NoData cells in the input as NoData pixels in the distance raster.
- Fixed_Buf_Val=n If this option is set, all cells within the MaxDist threshold are set to this value instead of the distance value.
- DataType The data type for the result if it is not given.
- Progress Progress function.
- ProgressData Additional parameter for the progress function.

Note
This GDAL function behind this API is called GDALComputeProximity.

Returns
The distance raster.

Code:
click to view

public method Geo::GDAL::Band::Domains ( )


Code:
click to view

public method Geo::GDAL::Band::Fill ( scalar  real_part,
scalar  imag_part = 0.0 
)

Object method.
Fill the band with a constant value.

Parameters
real_partReal component of fill value.
imag_partImaginary component of fill value.


Code:
click to view

public method Geo::GDAL::Band::FillNoData ( scalar  mask,
scalar  max_search_dist,
scalar  smoothing_iterations,
scalar  options,
coderef  progress,
scalar  progress_data 
)

Object method.
Interpolate values for cells in this raster. The cells to fill
should be marked in the mask band with zero.

Parameters
mask[optional] a mask band indicating cells to be interpolated (zero valued) (default is to get it with Geo::GDAL::Band::GetMaskBand).
max_search_dist[optional] the maximum number of cells to
search in all directions to find values to interpolate from (default is 10).
smoothing_iterations[optional] the number of 3x3 smoothing filter passes to run (0 or more) (default is 0).
options[optional] A reference to a hash. No options have been defined so far for this algorithm (default is {}).
progress[optional] a reference to a subroutine, which will
be called with parameters (number progress, string msg, progress_data) (default is undef).
progress_data[optional] (default is undef).

Documentation for GDAL algorithms

Code:
click to view

public method Geo::GDAL::Band::FlushCache ( )

Object method.
Write cached data to disk. There is usually no need to call this
method.

Code:
click to view

public scalar Geo::GDAL::Band::GetBandNumber ( )

Object method.

Returns
The index of this band in the parent dataset list of bands.

Code:
click to view

public method Geo::GDAL::Band::GetBlockSize ( )


Code:
click to view

public list Geo::GDAL::Band::GetDefaultHistogram ( scalar  force = 1,
coderef  progress = undef,
scalar  progress_data = undef 
)

Object method.

Parameters
forcetrue to force the computation
progress[optional] a reference to a subroutine, which will
be called with parameters (number progress, string msg, progress_data)
progress_data[optional]
Note
See Note in Geo::GDAL::Band::GetHistogram.
Returns
a list: ($min, $max, arrayref histogram).

Code:
click to view

public list Geo::GDAL::Band::GetHistogram ( hash  parameters)

Object method.
Compute histogram from the raster.

Parameters
parametersNamed parameters:
- Min the lower bound, default is -0.5
- Max the upper bound, default is 255.5
- Buckets the number of buckets in the histogram, default is 256
- IncludeOutOfRange whether to use the first and last values in the returned list
for out of range values, default is false;
the bucket size is (Max-Min) / Buckets if this is false and
(Max-Min) / (Buckets-2) if this is true
- ApproxOK if histogram can be computed from overviews, default is false
- Progress an optional progress function, the default is undef
- ProgressData data for the progress function, the default is undef
Note
Histogram counts are treated as strings in the bindings to be
able to use large integers (if GUIntBig is larger than Perl IV). In
practice this is only important if you have a 32 bit machine and
very large bucket counts. In those cases it may also be necessary to
use Math::BigInt.
Returns
a list which contains the count of values in each bucket

Code:
click to view

public Geo::GDAL::Band Geo::GDAL::Band::GetMaskBand ( )

Object method.

Returns
the mask band associated with this
band.

Code:
click to view

public list Geo::GDAL::Band::GetMaskFlags ( )

Object method.

Returns
the mask flags of the mask band associated with this
band. The flags are one or more of Geo::GDAL::Band::MaskFlags.

Code:
click to view

public scalar Geo::GDAL::Band::GetMaximum ( )

Object method.

Note
Call Geo::GDAL::Band::ComputeStatistics before calling
GetMaximum to make sure the value is computed.

Returns
statistical minimum of the band or undef if statistics are
not kept or computed in scalar context. In list context returns the
maximum value or a (kind of) maximum value supported by the data
type and a boolean value, which indicates which is the case (true is
first, false is second).

Code:
click to view

public scalar Geo::GDAL::Band::GetMinimum ( )

Object method.

Note
Call Geo::GDAL::Band::ComputeStatistics before calling
GetMinimum to make sure the value is computed.

Returns
statistical minimum of the band or undef if statistics are
not kept or computed in scalar context. In list context returns the
minimum value or a (kind of) minimum value supported by the data
type and a boolean value, which indicates which is the case (true is
first, false is second).

Code:
click to view

public Geo::GDAL::Band Geo::GDAL::Band::GetOverview ( scalar  index)

Object method.

Parameters
index0..GetOverviewCount-1
Returns
a Geo::GDAL::Band object, which represents the internal
overview band, or undef. if the index is out of bounds.

Code:
click to view

public scalar Geo::GDAL::Band::GetOverviewCount ( )

Object method.

Returns
the number of overviews available of the band.

Code:
click to view

public list Geo::GDAL::Band::GetStatistics ( scalar  approx_ok,
scalar  force 
)

Object method.

Parameters
approx_okWhether it is allowed to compute the statistics
based on overviews or similar.
forceWhether to force scanning of the whole raster.
Note
Uses Geo::GDAL::Band::ComputeStatistics internally.

Returns
a list ($min, $max, $mean, $stddev).

Code:
click to view

public method Geo::GDAL::Band::HasArbitraryOverviews ( )

Object method.

Returns
true or false.

Code:
click to view

public list Geo::GDAL::Band::MaskFlags ( )

Package subroutine.

Returns
the list of mask flags. These are
- AllValid: There are no invalid cell, all mask values will be 255.
When used this will normally be the only flag set.
- PerDataset: The mask band is shared between all bands on the dataset.
- Alpha: The mask band is actually an alpha band and may have values
other than 0 and 255.
- NoData: Indicates the mask is actually being generated from NoData values.
(mutually exclusive of Alpha).

Code:
click to view

public scalar Geo::GDAL::Band::NoDataValue ( scalar  NoDataValue)

Object method.
Get or set the "no data" value.

Parameters
NoDataValue[optional]
Note
$band->NoDataValue(undef) sets the NoData value to the
Posix floating point maximum. Use Geo::GDAL::Band::DeleteNoDataValue
to stop this band using a NoData value.
Returns
The NoData value or undef in scalar context. An undef
value indicates that there is no NoData value associated with this
band.

Code:
click to view

public scalar Geo::GDAL::Band::PackCharacter ( )

Object method.

Returns
The character to use in Perl pack and unpack for the data of this band.

Code:
click to view

public method Geo::GDAL::Band::Piddle ( scalar  piddle,
scalar  xoff = 0,
scalar  yoff = 0,
scalar  xsize = <width>,
scalar  ysize = <height>,
scalar  xdim,
scalar  ydim 
)

Object method.
Read or write band data from/into a piddle.

Note
The PDL module must be available for this method to work. Also, you
should 'use PDL' in the code that you use this method.

Parameters
piddle[only when writing] The piddle from which to read the data to be written into the band.
xoff,yoffThe offset for data in the band, default is top left (0, 0).
xsize,ysize[optional] The size of the window in the band.
xdim,ydim[optional, only when reading from a band] The size of the piddle to create.
Returns
A new piddle when reading from a band (no not use when writing into a band).

Code:
click to view

public Geo::OGR::Layer Geo::GDAL::Band::Polygonize ( hash  params)

Object method.
Polygonize this raster band.

Parameters
paramsNamed parameters:
- Mask A raster band, which is used as a mask to select polygonized areas. Default is undef.
- OutLayer A vector layer into which the polygons are written. If not given, an in-memory layer 'polygonized' is created and returned.
- PixValField The name of the field in the output layer into which the cell value of the polygon area is stored. Default is 'val'.
- Options Hash or list of options. Connectedness can be set to 8
to use 8-connectedness, otherwise 4-connectedness is
used. ForceIntPixel can be set to 1 to force using a 32 bit int buffer
for cell values in the process. If this is not set and the data type
of this raster does not fit into a 32 bit int buffer, a 32 bit float
buffer is used.
- Progress Progress function.
- ProgressData Additional parameter for the progress function.

Returns
Output vector layer.

Code:
click to view


Code:
click to view

public scalar Geo::GDAL::Band::ReadRaster ( hash  params)

Object method.
Read data from the band.

Parameters
paramsNamed parameters:
- XOff x offset (cell coordinates) (default is 0)
- YOff y offset (cell coordinates) (default is 0)
- XSize width of the area to read (default is the width of the band)
- YSize height of the area to read (default is the height of the band)
- BufXSize (default is undef, i.e., the same as XSize)
- BufYSize (default is undef, i.e., the same as YSize)
- BufType data type of the buffer (default is the data type of the band)
- BufPixelSpace (default is 0)
- BufLineSpace (default is 0)
- ResampleAlg one of Geo::GDAL::RIOResamplingTypes (default is 'NearestNeighbour'),
- Progress reference to a progress function (default is undef)
- ProgressData (default is undef)

Entry in GDAL docs (method RasterIO)
Returns
a buffer, open the buffer with unpack function of Perl. See Geo::GDAL::Band::PackCharacter.

Code:
click to view

public array reference Geo::GDAL::Band::ReadTile ( scalar  xoff = 0,
scalar  yoff = 0,
scalar  xsize = <width>,
scalar  ysize = <height> 
)

Object method.
Read band data into a Perl array.

Note
Accessing band data in this way is slow. Consider using PDL and Geo::GDAL::Band::Piddle.

Usage example (print the data from a band):
<br>print "@$_\n" for ( @{ $band->ReadTile() } );
<br>

Another usage example (process the data of a large dataset that has one band):
<br>my($W,$H) = $dataset->Band()->Size();
<br>my($xoff,$yoff,$w,$h) = (0,0,200,200);
<br>while (1) {
<br> if ($xoff >= $W) {
<br> $xoff = 0;
<br> $yoff += $h;
<br> last if $yoff >= $H;
<br> }
<br> my $data = $dataset->Band(1)->ReadTile($xoff,$yoff,min($W-$xoff,$w),min($H-$yoff,$h));
<br> # add your data processing code here
<br> $dataset->Band(1)->WriteTile($data,$xoff,$yoff);
<br> $xoff += $w;
<br>}
<br>
<br>sub min {
<br> return $_[0] < $_[1] ? $_[0] : $_[1];
<br>}
<br>

Parameters
xoffNumber of cell to skip before starting to read from a row. Pixels are read from left to right.
yoffNumber of cells to skip before starting to read from a column. Pixels are read from top to bottom.
xsizeNumber of cells to read from each row.
ysizeNumber of cells to read from each column.
Returns
a two-dimensional Perl array, organizes as data->[y][x], y =
0..height-1, x = 0..width-1. I.e., y is row and x is column.

Code:
click to view

public method Geo::GDAL::Band::Reclassify ( scalar  classifier,
scalar  progress = undef,
scalar  progress_data = undef 
)

Object method.
Reclassify the cells in the band.

Note
NoData values in integer rasters are reclassified if
explicitly specified in the hash classifier. However, they are not
reclassified to the default value, if one is specified. In real
valued rasters nodata cells are not reclassified.
If the subroutine is user terminated or the classifier is
incorrect, already reclassified cells will stay reclassified but an
error is raised.
Parameters
classifierFor integer rasters an anonymous hash, which
contains old class values as keys and new class values as values, or
an array classifier as in Geo::GDAL::Band::ClassCounts. In a hash
classifier a special key '*' (star) can be used as default, to act
as a fallback new class value. For real valued rasters the
classifier is as in Geo::GDAL::Band::ClassCounts.

Code:
click to view

public method Geo::GDAL::Band::RegenerateOverview ( Geo::GDAL::Band  overview,
scalar  resampling,
coderef  progress,
scalar  progress_data 
)

Object method.

Parameters
overviewa Geo::GDAL::Band object for the overview.
resampling[optional] the resampling method (one of Geo::GDAL::RIOResamplingTypes) (default is Average).
progress[optional] a reference to a subroutine, which will
be called with parameters (number progress, string msg, progress_data)
progress_data[optional]

Code:
click to view

public method Geo::GDAL::Band::RegenerateOverviews ( arrayref  overviews,
scalar  resampling,
coderef  progress,
scalar  progress_data 
)

Object method.

Todo:
This is not yet available

Parameters
overviewsa list of Geo::GDAL::Band objects for the overviews.
resampling[optional] the resampling method (one of Geo::GDAL::RIOResamplingTypes) (default is Average).
progress[optional] a reference to a subroutine, which will
be called with parameters (number progress, string msg, progress_data)
progress_data[optional]

Code:
click to view

public method Geo::GDAL::Band::ScaleAndOffset ( scalar  scale,
scalar  offset 
)

Object method.
Scale and offset are used to transform raw cell values into the
units returned by GetUnits(). The conversion function is:

<br>Units value = (raw value * scale) + offset
<br>


Returns
a list ($scale, $offset), the values are undefined if they
are not set.
Since
version 1.9 of the bindings.

Code:
click to view

public list Geo::GDAL::Band::SetDefaultHistogram ( scalar  min,
scalar  max,
scalar  histogram 
)

Object method.

Parameters
min
max
Note
See Note in Geo::GDAL::Band::GetHistogram.
Parameters
histogramreference to an array containing the histogram

Code:
click to view

public method Geo::GDAL::Band::SetStatistics ( scalar  min,
scalar  max,
scalar  mean,
scalar  stddev 
)

Object method.
Save the statistics of the band if possible (the format can save
arbitrary metadata).

Parameters
min
max
mean
stddev

Code:
click to view

public Geo::GDAL::Band Geo::GDAL::Band::Sieve ( hash  params)

Object method.
Remove small areas by merging them into the largest neighbour area.

Parameters
paramsNamed parameters:
- Mask A raster band, which is used as a mask to select sieved areas. Default is undef.
- Dest A raster band into which the result is written. If not given, an new in-memory raster band is created and returned.
- Threshold The smallest area size (in number of cells) which are not sieved away.
- Options Hash or list of options. {Connectedness => 4} can be specified to use 4-connectedness, otherwise 8-connectedness is used.
- Progress Progress function.
- ProgressData Additional parameter for the progress function.

Returns
The filtered raster band.

Code:
click to view

public list Geo::GDAL::Band::Size ( )

Object method.

Returns
The size of the band as a list (width, height).

Code:
click to view

public method Geo::GDAL::Band::Unit ( scalar  type)

Object method.

Parameters
type[optional] the unit (a string).
Note
$band->Unit(undef) sets the unit value to an empty string.
Returns
the unit (a string).
Since
version 1.9 of the bindings.

Code:
click to view

public method Geo::GDAL::Band::WriteRaster ( hash  params)

Object method.
Write data into the band.

Parameters
paramsNamed parameters:
- XOff x offset (cell coordinates) (default is 0)
- YOff y offset (cell coordinates) (default is 0)
- XSize width of the area to write (default is the width of the band)
- YSize height of the area to write (default is the height of the band)
- Buf a buffer (or a reference to a buffer) containing the data. Create the buffer with pack function of Perl. See Geo::GDAL::Band::PackCharacter.
- BufXSize (default is undef, i.e., the same as XSize)
- BufYSize (default is undef, i.e., the same as YSize)
- BufType data type of the buffer (default is the data type of the band)
- BufPixelSpace (default is 0)
- BufLineSpace (default is 0)

Entry in GDAL docs (method RasterIO)

Code:
click to view

public method Geo::GDAL::Band::WriteTile ( scalar  data,
scalar  xoff = 0,
scalar  yoff = 0 
)

Object method.
Write band data from a Perl array.

Note
Accessing band data in this way is slow. Consider using PDL and Geo::GDAL::Band::Piddle.

Parameters
dataA two-dimensional Perl array, organizes as data->[y][x], y =
0..height-1, x = 0..width-1.
xoff
yoff


Code:
click to view


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