[Proj] Differences in reprojection between using the cs2cs app and using the api
Adri CS
acsantome at gmail.com
Wed Feb 11 09:07:59 PST 2015
Hi,
I built Proj4 4.8.0 for Windows with MinGW. I'm trying to reproject some
WGS84 lat/long coordinates (degrees) from Brazil to UTM Sirgas 2000. The
UTM zone would be 23S.
**) Using the cs2cs app:
*cs2cs.exe -f %.6f +init=epsg:3273 +proj=latlong +to +init=epsg:31938
input.txt > output.txt*
**The input file would contain coords like this: -45.491596 -23.570147
769.750000
And the output would be: 449834.145105 7393276.784821 769.750000
/***********************************************/
**) Using the api (I omit the error checking):
*projPJ wgs = pj_init_plus("+init=epsg:32723 +proj=latlong");*
*projPJ sirgas = = pj_init_plus("+init=epsg:31983");*
*double lat = -45.491596;*
*double lon = -23.570147;double alt = 769.750000;*
*lat *= DEG_TO_RAD;*
*lon *= DEG_TO_RAD;*
*pj_transform(wgs, sirgas, 1, 1, &lon, &lat, &alt);*
This outputs: 449834.127632 7393276.821296 769.750000
In both cases, the left part of the returned UTM easting and northing
coordinates are the same, but the numbers after the decimal point are
different.
I'm only transforming the input lat/lon coordintates when using the api,
since if I transform them before calling cs2cs, it will output wron coords
(the easting will have 7 digits before the decimal points).
What's happening here? The only difference I can see it's the
transformation of the lat/lon coordinates from degrees to radians: I'm
multypling directly while in the cs2cs source, there's a call to the
*dmstor* function (which I can't call directly, it seems).
Thanks for your time & cheers!
Adri.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20150211/a80c4ea6/attachment.html>
More information about the Proj
mailing list