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!
This example will transform a vector dataset from spatial reference system EPSG 2392 to EPSG 2393. The geometries are translated by (dx, dy) = (2500000, 6600000) before applying the transformation.
$dsname = shift @ARGV;
$lname = shift @ARGV;
$layer1 = $datasource->Layer($lname) or die;
$dsname = shift @ARGV;
$lname = shift @ARGV;
$layer2 = $datasource->CreateLayer
({ Name => $lname, SRS => $sr2, GeometryType => $layer1->GetLayerDefn->GeometryType});
$layer2->Schema( $layer1->Schema );
$layer1->ResetReading();
while ($feature = $layer1->GetNextFeature()) {
my $geom = $feature->GetGeometry();
$geom->Move(2500000, 6600000);
$geom->Transform($tr);
$layer2->InsertFeature($feature);
}
public Geo::GDAL::Dataset Create(hash params)
GDAL utility functions and a root class for raster classes.
public Geo::GDAL::Driver Driver(scalar name)
public Geo::GDAL::Dataset Open(scalar name, scalar update=0)
A spatial reference system.
public Geo::OSR::SpatialReference new(hash params)