[PROJ] Translate command into equivalent c++ function
Ali Akram
devtoona at gmail.com
Wed Mar 29 03:43:24 PDT 2023
Hello,
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 returns to me the same coordinates that I send in input i.e, 56,12 .
Kindly help thanks
Regards,
Ali
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20230329/30da7edb/attachment.htm>
More information about the PROJ
mailing list