Start by checking whether your call to proj_create_crs_to_crs succeeds (i.e. whether it returns NULL or not, as also suggested in the PROJ documentation over at https://proj.org/development/quickstart.html). And in general always check the return status of function calls, cf. e.g. https://proj.org/development/errorhandling.html
If NULL is returned, your PROJ installation is probably not complete (lacking support files and/or setting of environment variables). In that case follow the tracks laid out in https://proj.org/resource_files.html /Thomas Den ons. 29. mar. 2023 kl. 12.43 skrev Ali Akram <[email protected]>: > 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 > _______________________________________________ > PROJ mailing list > [email protected] > https://lists.osgeo.org/mailman/listinfo/proj >
_______________________________________________ PROJ mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/proj
