Subject: | transform returning 'nan' for epsg:29902 |
Hi,
I have come up against this issue which is not in any way critical but would like to get to the bottom of. When I try to transform() to or from Irish National Grid (EPSG 29902 and 29903) I get 'nan' as a result. I get normal results when I use inverse(), when I use the cs2cs command, and when I use transform() in python, as outlined below.
Thanks, Paul
perl v5.18.4
Mac OSX 10.11
proj4 libVersion: 4.9.3.
# --- perl
my $epsg_4326 = Geo::Proj4->new(init => "epsg:4326");
my $epsg_2157 = Geo::Proj4->new(init => "epsg:2157"); # Irish Transverse Mercator
my $epsg_29902 = Geo::Proj4->new(init => "epsg:29902"); # Irish National Grid
my ($lat,$lon,$point);
($lat,$lon) = $epsg_2157->inverse(600000,750000);
print "epsg_2157 inverse: $lon $lat\n";
($lat,$lon) = $epsg_29902->inverse(200000,250000);
print "epsg_29902 inverse: $lon $lat\n";
$point = $epsg_2157->transform( $epsg_4326, [600000,750000] );
print "epsg_2157 transform: @$point\n";
$point = $epsg_29902->transform( $epsg_4326, [200000,250000] );
print "epsg_29902 transform: @$point\n";
$point = $epsg_4326->transform( $epsg_2157, [-8,53.5] );
print "epsg_4326 transform: @$point\n";
$point = $epsg_4326->transform( $epsg_29902, [-8,53.5] );
print "epsg_4326 transform : @$point\n";
# OUTPUT
epsg_2157 inverse: -8 53.5
epsg_29902 inverse: -8 53.5
epsg_2157 transform: -8 53.5
epsg_29902 transform: nan nan
epsg_4326 transform epsg_2157: 600000 750000
epsg_4326 transform epsg_29902: nan nan
# --- cs2cs
$ cs2cs +init=epsg:29902 +to +init=epsg:4326
200000 250000
8d0'2.659"W 53d30'0.76"N 54.901
$ cs2cs +init=epsg:4326 +to +init=epsg:29902
-8 53.5
200049.01 249976.50 -54.90
# --- python
import pyproj
p1 = pyproj.Proj(init='epsg:29902')
p2 = pyproj.Proj(init='epsg:4326')
x1 = 200000
y1 = 250000
x2, y2 = pyproj.transform(p1,p2,x1,y1)
print x2,y2
x1 = -8
y1 = 53.5
x2, y2 = pyproj.transform(p2,p1,x1,y1)
print x2,y2
# OUTPUT
-8.00073850523 53.5002111685
200049.008604 249976.497