Geo::GDAL
1.11
|
Public Object Methods | |
scalar | GetBandNumber () |
scalar | DataType () |
list | Size () |
list | GetBlockSize () |
scalar | ColorInterpretation (scalar color_interpretation) |
scalar | NoDataValue (scalar NoDataValue) |
Unit (scalar type) | |
ScaleAndOffset (scalar scale, scalar offset) | |
scalar | GetMinimum () |
scalar | GetMaximum () |
list | ComputeStatistics (scalar approx_ok) |
list | GetStatistics (scalar approx_ok, scalar force) |
SetStatistics (scalar min, scalar max, scalar mean, scalar stddev) | |
scalar | GetOverviewCount () |
Geo::GDAL::Band | GetOverview (scalar band) |
HasArbitraryOverviews () | |
scalar | Checksum (scalar xoff=0, scalar yoff=0, scalar xsize=undef, scalar ysize=undef) |
ComputeRasterMinMax (scalar approx_ok=0) | |
ComputeBandStats (scalar samplestep=1) | |
Fill (scalar real_part, scalar imag_part=0.0) | |
WriteTile (scalar data, scalar xoff=0, scalar yoff=0) | |
listref | ReadTile (scalar xoff=0, scalar yoff=0, scalar xsize=< width >, scalar ysize=< height >) |
WriteRaster (scalar xoff, scalar yoff, scalar xsize, scalar ysize, scalar buf, scalar buf_xsize=undef, scalar buf_ysize=undef, scalar buf_type=undef) | |
scalar | ReadRaster (scalar xoff, scalar yoff, scalar xsize, scalar ysize, scalar buf_xsize=undef, scalar buf_ysize=undef, scalar buf_type=undef) |
list | GetHistogram (hash parameters) |
list | GetDefaultHistogram (scalar force=1, scalar callback=undef, scalar callback_data=undef) |
list | SetDefaultHistogram (scalar min, scalar max, scalar histogram) |
FlushCache () | |
Geo::GDAL::ColorTable | ColorTable (scalar ColorTable) |
Geo::GDAL::ColorTable | GetColorTable () |
SetColorTable (scalar ColorTable) | |
CreateMaskBand () | |
Geo::GDAL::Band | GetMaskBand () |
scalar | GetMaskFlags () |
list | CategoryNames (list names) |
scalar | GetRasterCategoryNames () |
SetRasterCategoryNames (scalar names) | |
Geo::GDAL::RasterAttributeTable | AttributeTable (scalar AttributeTable) |
Geo::GDAL::RasterAttributeTable | GetDefaultRAT () |
SetDefaultRAT (scalar AttributeTable) | |
Geo::OGR::Layer | Contours (scalar DataSource, hashref LayerConstructor, scalar ContourInterval, scalar ContourBase, listref FixedLevels, scalar NoDataValue, scalar IDField, scalar ElevField, scalar callback, scalar callback_data) |
FillNodata (scalar mask, scalar max_search_dist=10, scalar smoothing_iterations=0, scalar options=ref_to_anon_empty_hash, scalar callback, scalar callback_data) | |
Public Attributes | |
list | COLOR_INTERPRETATIONS |
XSize | |
YSize |
Geo::GDAL::RasterAttributeTable Geo::GDAL::Band::AttributeTable | ( | scalar | AttributeTable | ) |
AttributeTable | [optional] A Geo::GDAL::RasterAttributeTable object. |
list Geo::GDAL::Band::CategoryNames | ( | list | names | ) |
names | [optional] |
scalar Geo::GDAL::Band::Checksum | ( | scalar | xoff = 0 , |
scalar | yoff = 0 , |
||
scalar | xsize = undef , |
||
scalar | ysize = undef |
||
) |
Computes a checksum from the raster or a part of it.
xoff | |
yoff | |
xsize | |
ysize |
scalar Geo::GDAL::Band::ColorInterpretation | ( | scalar | color_interpretation | ) |
color_interpretation | [optional] new color interpretation, one of @Geo::GDAL::Band::COLOR_INTERPRETATIONS |
Geo::GDAL::ColorTable Geo::GDAL::Band::ColorTable | ( | scalar | ColorTable | ) |
Get or set the color table of this band.
ColorTable | [optional] a Geo::GDAL::ColorTable object |
Geo::GDAL::Band::ComputeBandStats | ( | scalar | samplestep = 1 | ) |
samplestep |
Geo::GDAL::Band::ComputeRasterMinMax | ( | scalar | approx_ok = 0 | ) |
list Geo::GDAL::Band::ComputeStatistics | ( | scalar | approx_ok | ) |
approx_ok | Whether it is allowed to compute the statistics based on overviews or similar. |
Geo::OGR::Layer Geo::GDAL::Band::Contours | ( | scalar | DataSource, |
hashref | LayerConstructor, | ||
scalar | ContourInterval, | ||
scalar | ContourBase, | ||
listref | FixedLevels, | ||
scalar | NoDataValue, | ||
scalar | IDField, | ||
scalar | ElevField, | ||
scalar | callback, | ||
scalar | callback_data | ||
) |
Generate contours for this raster band. This method can also be used with named parameters.
An example:
use Geo::GDAL; $dem = Geo::GDAL::Open('dem.gtiff'); $contours = $dem->Band->Contours(ContourInterval => 10, ElevField => 'z'); $n = $contours->GetFeatureCount;
DataSource | a Geo::OGR::DataSource object, default is a Memory data source |
LayerConstructor | data for Geo::OGR::DataSource::CreateLayer, default is {Name => 'contours'} |
ContourInterval | default is 100 |
ContourBase | default is 0 |
FixedLevels | a reference to a list of fixed contour levels, default is [] |
NoDataValue | default is undef |
IDField | default is '', i.e., no field (the field is created if this is given) |
ElevField | default is '', i.e., no field (the field is created if this is given) |
callback | [optional] a reference to a subroutine, which will be called with parameters (number progress, string msg, callback_data) |
callback_data | [optional] |
scalar Geo::GDAL::Band::DataType | ( | ) |
Geo::GDAL::Band::Fill | ( | scalar | real_part, |
scalar | imag_part = 0.0 |
||
) |
Fill the band with a constant value.
real_part | Real component of fill value. |
imag_part | Imaginary component of fill value. |
Geo::GDAL::Band::FillNodata | ( | scalar | mask, |
scalar | max_search_dist = 10 , |
||
scalar | smoothing_iterations = 0 , |
||
scalar | options = ref_to_anon_empty_hash , |
||
scalar | callback, | ||
scalar | callback_data | ||
) |
mask | a mask band indicating pixels to be interpolated (zero valued) |
max_search_dist | [optional] the maximum number of pixels to search in all directions to find values to interpolate from. |
smoothing_iterations | [optional] the number of 3x3 smoothing filter passes to run (0 or more). |
options | [optional] A reference to a hash. No options have been defined so far for this algorithm. |
callback | [optional] a reference to a subroutine, which will be called with parameters (number progress, string msg, callback_data) |
callback_data | [optional] |
Write cached data to disk. There is usually no need to call this method.
scalar Geo::GDAL::Band::GetBandNumber | ( | ) |
list Geo::GDAL::Band::GetBlockSize | ( | ) |
list Geo::GDAL::Band::GetDefaultHistogram | ( | scalar | force = 1 , |
scalar | callback = undef , |
||
scalar | callback_data = undef |
||
) |
force | true to force the computation |
callback | [optional] a reference to a subroutine, which will be called with parameters (number progress, string msg, callback_data) |
callback_data | [optional] |
list Geo::GDAL::Band::GetHistogram | ( | hash | parameters | ) |
Compute histogram from the raster.
parameters | Named parameters:
|
scalar Geo::GDAL::Band::GetMaskFlags | ( | ) |
scalar Geo::GDAL::Band::GetMaximum | ( | ) |
scalar Geo::GDAL::Band::GetMinimum | ( | ) |
Geo::GDAL::Band Geo::GDAL::Band::GetOverview | ( | scalar | band | ) |
band | 0..GetOverviewCount-1 |
scalar Geo::GDAL::Band::GetOverviewCount | ( | ) |
scalar Geo::GDAL::Band::GetRasterCategoryNames | ( | ) |
list Geo::GDAL::Band::GetStatistics | ( | scalar | approx_ok, |
scalar | force | ||
) |
approx_ok | Whether it is allowed to compute the statistics based on overviews or similar. |
force | Whether to force scanning of the whole raster. |
scalar Geo::GDAL::Band::NoDataValue | ( | scalar | NoDataValue | ) |
NoDataValue | [optional] Get or set the no data value. |
scalar Geo::GDAL::Band::ReadRaster | ( | scalar | xoff, |
scalar | yoff, | ||
scalar | xsize, | ||
scalar | ysize, | ||
scalar | buf_xsize = undef , |
||
scalar | buf_ysize = undef , |
||
scalar | buf_type = undef |
||
) |
xoff | |
yoff | |
xsize | |
ysize | |
buf_xsize | |
buf_ysize | |
buf_type |
listref Geo::GDAL::Band::ReadTile | ( | scalar | xoff = 0 , |
scalar | yoff = 0 , |
||
scalar | xsize = <width> , |
||
scalar | ysize = <height> |
||
) |
Usage example (print the data from a band):
print "@$_\n" for ( @{ $band->ReadTile() } );
Another usage example (process the data of a large dataset that has one band):
my($W,$H) = $dataset->Band(1)->Size(); my($xoff,$yoff,$w,$h) = (0,0,200,200); while (1) { if ($xoff >= $W) { $xoff = 0; $yoff += $h; last if $yoff >= $H; } my $data = $dataset->Band(1)->ReadTile($xoff,$yoff,min($W-$xoff,$w),min($H-$yoff,$h)); # add your data processing code here $dataset->Band(1)->WriteTile($data,$xoff,$yoff); $xoff += $w; } sub min { return $_[0] < $_[1] ? $_[0] : $_[1]; }
xoff | |
yoff | |
xsize | |
ysize |
Geo::GDAL::Band::ScaleAndOffset | ( | scalar | scale, |
scalar | offset | ||
) |
Scale and offset are used to transform raw pixel values into the units returned by GetUnits(). The conversion function is:
Units value = (raw value * scale) + offset
Geo::GDAL::Band::SetColorTable | ( | scalar | ColorTable | ) |
ColorTable | A color table object. |
list Geo::GDAL::Band::SetDefaultHistogram | ( | scalar | min, |
scalar | max, | ||
scalar | histogram | ||
) |
min | |
max | |
histogram | reference to an array containing the histogram |
Geo::GDAL::Band::SetDefaultRAT | ( | scalar | AttributeTable | ) |
AttributeTable | a Geo::GDAL::RasterAttributeTable object |
Geo::GDAL::Band::SetRasterCategoryNames | ( | scalar | names | ) |
names |
Geo::GDAL::Band::SetStatistics | ( | scalar | min, |
scalar | max, | ||
scalar | mean, | ||
scalar | stddev | ||
) |
Save the statistics of the band if possible (the format can save arbitrary metadata).
min | |
max | |
mean | |
stddev |
list Geo::GDAL::Band::Size | ( | ) |
Geo::GDAL::Band::Unit | ( | scalar | type | ) |
type | [optional] the unit (a string). |
Geo::GDAL::Band::WriteRaster | ( | scalar | xoff, |
scalar | yoff, | ||
scalar | xsize, | ||
scalar | ysize, | ||
scalar | buf, | ||
scalar | buf_xsize = undef , |
||
scalar | buf_ysize = undef , |
||
scalar | buf_type = undef |
||
) |
xoff | |
yoff | |
xsize | |
ysize | |
buf | The data to be written in a binary buffer. Use the pack function of Perl to prepare a buffer. |
buf_xsize | |
buf_ysize | |
buf_type |
Geo::GDAL::Band::WriteTile | ( | scalar | data, |
scalar | xoff = 0 , |
||
scalar | yoff = 0 |
||
) |
data | A two-dimensional Perl array, organizes as data->[y][x], y = 0..height-1, x = 0..width-1. |
xoff | |
yoff |
scalar (access as $band->{XSize})
scalar (access as $band->{YSize})