[PROJ] Transforming coordinates in C++

Even Rouault even.rouault at spatialys.com
Fri Oct 29 03:17:32 PDT 2021


Le 29/10/2021 à 12:00, Javier Jimenez Shaw a écrit :
> Hi
>
> Using C++ I am trying this: Given two CRSs, I would like to have 
> access to the list of possible transformations (like with projinfo), 
> and use those transformations to transform coordinates (like with cs2cs).
>
> Studying the code of projinfo, that uses mainly the C++ API, I already 
> have a std::vector<CoordinateOperationNNPtr>. Nice, I can dump them in 
> different formats.
>
> However, when I go to the code of cs2cs, I see that it is mainly using 
> the C API.
>
> Is there any C++ equivalent to the function
> PJ_COORD proj_trans (PJ *P, PJ_DIRECTION direction, PJ_COORD coord);
> ?

No.

If you know which transformation you want to do, what you can easily do 
is exportToPROJString() it, and use proj_create() to instanciate it as a 
PJ* object you can use with proj_trans()

That's more or less what proj_create_operations() + proj_list_get() do.

Even

>
> Thanks.
> .___ ._ ..._ .. . ._. .___ .. __ . _. . __..  ... .... ._ .__
> Entre dos pensamientos racionales
> hay infinitos pensamientos irracionales.
>
>
> _______________________________________________
> PROJ mailing list
> PROJ at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/proj

-- 
http://www.spatialys.com
My software is free, but my time generally not.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20211029/5e23b2da/attachment.html>


More information about the PROJ mailing list