[Proj] Differences in reprojection between using the cs2cs app and using the api

Jose Gonçalves jagoncal at gmail.com
Wed Feb 11 13:23:56 PST 2015


Hi
The differences in the UTM coordinates are smaller than 5 cm. This agrees
with a rounding error in the 6th decimal place of the geographic
coordinates. Your geographic coordinates are presented with 6 decimal
places. If in some of the cases they are not actually rounded, the results
will be different.
Regards

José

2015-02-11 17:07 GMT+00:00 Adri CS <acsantome at gmail.com>:

> 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.
>
> _______________________________________________
> Proj mailing list
> Proj at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/proj
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20150211/0b3192a2/attachment.html>


More information about the Proj mailing list