[PROJ] Different results from cs2cs vs C API code

henning at kaarta.com henning at kaarta.com
Tue Sep 22 14:13:40 PDT 2020


Hi,

I'm trying to write C++ code referencing the proj7 API, to convert a set of
lat/lon/alt points to a user-specified target CRS. Following the example in
the proj documentation, I use proj_create_crs_to_crs() to establish source
and target CRS, then proj_trans() to transform individual points. I hopes of
validating the results, I thought I should test by feeding the same input
coordinates to cs2cs on the command line, with the same CRS definitions
(using epsg:xxxx+yyyy form in both the code and the cs2cs command), but I
get different results, not outrageous but as much as dozens of meters. In
some simpler tests, using only epsg:xxxx, I can get matching results. Is
there something special about the epsg:xxxx+yyyy format that needs to be
treated differently in C++ code vs. the command line usage?

 

For example:

 

echo "-33 151 5" | cs2cs -d 8 EPSG:4326+5773 +to EPSG:7856+5711

313152.77721557              6346936.49571435 5.28067830

 

But with the same input values in the C++ code, the results are

313188.89746084268    6347047.2885914352    4.940935415625713

 

Am I missing something fundamental here?

Thanks!



-- 
This email has been checked for viruses by AVG.
https://www.avg.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20200922/c5520942/attachment.html>


More information about the PROJ mailing list