[Proj] converting WGS84 to NAD27
Anna Hentzel
wibge at gmail.com
Sun Oct 4 17:22:03 EST 2009
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
More information about the Proj
mailing list