[PROJ] Translate command into equivalent c++ function

Ali Akram Ali.Akram at teo-intl.com
Wed Mar 29 03:03:11 PDT 2023


I want to use this to translate WSG84 to UMT and I am able to execute this command from terminal
echo 56 12 | cs2cs +init=epsg:4326 +to +init=epsg:25832 with output as 6231950.54 1920310.71 0.00 now trying to achieve it from c++ code and here is my way
PJ_CONTEXT *C;
PJ *P;
C = proj_context_create();

P = proj_create_crs_to_crs(C, "EPSG:4326", "EPSG:6677", NULL);
PJ_COORD input_coords, output_coords;
input_coords = proj_coord(56,12, 0, 0);
output_coords = proj_trans(P, PJ_FWD, input_coords);
std::string result = "";
result.append(std::to_string(output_coords.xy.x)+","+ std::to_string(output_coords.xy.y));
proj_destroy(P);
proj_context_destroy(C);


But it return to me same coordinates what i send in input i.e, 56,12. Kindly help thanks

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20230329/e585fbac/attachment-0001.htm>


More information about the PROJ mailing list