converting WGS84 to NAD27

2 messages Options
Embed this post
Permalink
wibge

converting WGS84 to NAD27

Reply Threaded More More options
Print post
Permalink
Hi,

I'm trying to convert WGS84 coordinates to UTM and NAD27. I'm using
the route-me library, which is a thin wrapper on proj4. It just
creates the PJ objects using pj_init_plus on the strings, and calls
pg_transform. The transformation to UTM works correctly, but the NAD27
transformation doesn't change the coordinates. Does anyone know what I
might be doing wrong?

CLLocationCoordinate2D coord = {60, -119};
int zone = ((coord.longitude + 186) / 6);

RMProjection* latLonProj = [[RMProjection alloc]
initWithString:@"+proj=latlong +ellps=WGS84 +datum=WGS84"];
RMProjection* utmProj = [[RMProjection alloc] initWithString:
[NSString stringWithFormat:@"+proj=utm +zone=%d +ellps=WGS84", zone]];

RMTransform* trans = [[RMTransform alloc] initFrom:latLonProj To:utmProj];

CLLocationCoordinate2D transCoord = [trans projectForward:coord AtZoom:9];
NSLog(@"UTM Coord %f, %f %d" , transCoord.latitude, transCoord.longitude, zone);

RMProjection* nad27Proj = [[RMProjection alloc]
initWithString:@"+proj=latlong +ellps=WGS84 +datum=NAD27 +no_defs"];
trans = [[RMTransform alloc] initFrom:latLonProj To:nad27Proj];
transCoord = [trans projectForward:coord AtZoom:9];
NSLog(@"NAD27 Coord %f, %f" , transCoord.latitude, transCoord.longitude);

**output**
UTM Coord 6653097.435298, 388455.958023 11
NAD27 Coord 60.000000, -119.000000


Thanks,
Anna
_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj
Tamas Szekeres

Re: converting WGS84 to NAD27

Reply Threaded More More options
Print post
Permalink
Anna,

You should probably install those 'datum shift grid files' as per http://trac.osgeo.org/proj/, and set up their location in the PROJ_LIB environment setting.
In case if you're on Windows the files are already included in the pre-compiled packages available from here: http://vbkto.dyndns.org:1280/sdk/
The files are located in the /bin/proj/SHARE subdirectory.

Best regards,

Tamas



2009/10/5 Anna Hentzel <[hidden email]>
Hi,

I'm trying to convert WGS84 coordinates to UTM and NAD27. I'm using
the route-me library, which is a thin wrapper on proj4. It just
creates the PJ objects using pj_init_plus on the strings, and calls
pg_transform. The transformation to UTM works correctly, but the NAD27
transformation doesn't change the coordinates. Does anyone know what I
might be doing wrong?

CLLocationCoordinate2D coord = {60, -119};
int zone = ((coord.longitude + 186) / 6);

RMProjection* latLonProj = [[RMProjection alloc]
initWithString:@"+proj=latlong +ellps=WGS84 +datum=WGS84"];
RMProjection* utmProj = [[RMProjection alloc] initWithString:
[NSString stringWithFormat:@"+proj=utm +zone=%d +ellps=WGS84", zone]];

RMTransform* trans = [[RMTransform alloc] initFrom:latLonProj To:utmProj];

CLLocationCoordinate2D transCoord = [trans projectForward:coord AtZoom:9];
NSLog(@"UTM Coord %f, %f %d" , transCoord.latitude, transCoord.longitude, zone);

RMProjection* nad27Proj = [[RMProjection alloc]
initWithString:@"+proj=latlong +ellps=WGS84 +datum=NAD27 +no_defs"];
trans = [[RMTransform alloc] initFrom:latLonProj To:nad27Proj];
transCoord = [trans projectForward:coord AtZoom:9];
NSLog(@"NAD27 Coord %f, %f" , transCoord.latitude, transCoord.longitude);

**output**
UTM Coord 6653097.435298, 388455.958023 11
NAD27 Coord 60.000000, -119.000000


Thanks,
Anna
_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj


_______________________________________________
Proj mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/proj