Reading a raster dataset

The code here does not have any warranty. It is recommended that before using any of this code, you look into it and try to understand what it does, what input it needs, etc. Do not blindly execute anything!

use Geo::GDAL;

$file = shift @ARGV;

$dataset = Geo::GDAL::Open($file);
die "can't open $file as a raster dataset" unless $dataset;

($minx, $dx, undef, $maxy, undef, $dy) = $dataset->GeoTransform();
($width, $height) = $dataset->Size;
$band = $dataset->GetRasterBand(1);

$data = $band->ReadTile;

print @$data == $height ? "ok\n" : "not ok\n";

Generated on 26 May 2013 for Geo::GDAL by  doxygen 1.4.7