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

Hermann Peifer peifer at gmx.eu
Wed Feb 11 11:00:43 PST 2015


Hi,

I can only provide a few hints based on your examples below:

epsg:3273 is not the same as epsg:32723, neither are epsg:31938 and 
epsg:31983

These combinations do not make sense: +init=epsg:3273 +proj=latlong and 
init=epsg:32723 +proj=latlong

epsg:32723 resolves into: +proj=utm +zone=23 +south +datum=WGS84 
+units=m +no_defs. The projection cannot be latlong and utm at the same 
time. The same goes for latlong and lcc in the other case.

Luckily the software ignores some of the specified parameters. It would 
however be better to use this definition and see if it helps: 
+init=epsg:4326 +to +init=epsg:31983.

My results with Rel. 4.9.0, 13 September 2014
$ echo -45.491596 -23.570147 | cs2cs -f "%.6f" +init=epsg:4326 +to 
+init=epsg:31983
449834.145105	7393276.784821 0.000000

Hope this helps, Hermann

On 2015-02-11 18:07, Adri CS wrote:
> 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
>




More information about the Proj mailing list