File: use_epsg.pl

package info (click to toggle)
libgeo-proj4-perl 1.05-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 164 kB
  • ctags: 232
  • sloc: ansic: 362; perl: 347; makefile: 2
file content (44 lines) | stat: -rw-r--r-- 1,115 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/perl -w
# Example contributed by Michael R. Davis, see after __END__

use strict;
use warnings;
use Geo::Proj4 ();

my $epsg = 26985;
my $proj = Geo::Proj4->new(init => "epsg:$epsg")
  or die "cannot use EPSG 26985: ",Geo::Proj4->error, "\n";

my ($x, $y) = (401717.80, 130013.88);
my ($lat, $lon) = $proj->inverse($x, $y);
print "  x: $x\n  y: $y\nlat: $lat\nlon: $lon\n";

__END__

Proj4 EPSG Example
  Convert SPCS83 Maryland zone (meters) to Latitude and Longitude

Projection Input:
  Code - CRS: 26985
  CRS Name: NAD83 / Maryland
  CRS Type: projected
  Coord Sys code: 4499
  CS Type: Cartesian
  Dimension: 2
  Remarks: Used in projected and engineering coordinate reference systems.
  CRS Name: NAD83
  Datum Name: North American Datum 1983
  Datum Origin: Origin at geocentre.
  Ellipsoid Name: GRS 1980
  Ellipsoid Unit: metre
  Coord Operation Name: SPCS83 Maryland zone (meters)
  Coord Op Method Name: Lambert Conic Conformal (2SP)

Output
  Unprojected Latitude and Longitude, probably with GRS80 ellipsoids.

Copyright
  Copyright 2007 Michael R. Davis

License
  MIT, BSD, Perl, or GPL