[PROJ] Transforming coordinates in C++

Javier Jimenez Shaw j1 at jimenezshaw.com
Fri Oct 29 04:49:38 PDT 2021


Thanks Even.

I see that proj_create takes a PJ_CONTEXT *ctx as the first argument. What
I have in C++ is a DatabaseContextPtr. Can I get a PJ_CONTEXT* from a
DatabaseContextPtr?
.___ ._ ..._ .. . ._.  .___ .. __ . _. . __..  ... .... ._ .__
Entre dos pensamientos racionales
hay infinitos pensamientos irracionales.



On Fri, 29 Oct 2021 at 12:17, Even Rouault <even.rouault at spatialys.com>
wrote:

>
> 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 listPROJ at lists.osgeo.orghttps://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/3976676d/attachment.html>


More information about the PROJ mailing list