CodeSnippets: testOSR.pl
| File testOSR.pl, 407 bytes (added by darkblueB, 8 months ago) |
|---|
| Line | |
|---|---|
| 1 | #!/usr/bin/perl |
| 2 | |
| 3 | |
| 4 | use Geo::GDAL; |
| 5 | use Geo::OGR; |
| 6 | |
| 7 | my $x = 10000.0; |
| 8 | my $y = 20000.0; |
| 9 | |
| 10 | $inOSR = Geo::OSR::SpatialReference->new(); |
| 11 | $inOSR->ImportFromEPSG(3395); |
| 12 | |
| 13 | $outOSR = Geo::OSR::SpatialReference->new(); |
| 14 | $outOSR->ImportFromEPSG(4326); |
| 15 | |
| 16 | my $transf = new Geo::OSR::CoordinateTransformation( $inOSR, $outOSR ); |
| 17 | my $res = $transf->TransformPoint( $x, $y); |
| 18 | |
| 19 | print $res->[0] . ',' . $res->[1] . ',' . $res->[2]; |
| 20 | |
| 21 |
