[PROJ] Reversing a coordinate operation via proj api

Nyall Dawson nyall.dawson at gmail.com
Thu Dec 12 16:06:19 PST 2019


On Fri, 13 Dec 2019 at 09:55, Even Rouault <even.rouault at spatialys.com> wrote:
>
> Hi Nyall,
>
> > If I have a proj string representing a coordinate operation, is there
> > any existing proj c api to reverse this operation?
>
> Do you mean, to get a PROJ string corresponding to the reverse operation ?

Yes. Or even if there was a method to take any given PROJ coordinate
operation object which is already constructed and create a reversed
clone of it.

> Then, no. Although that would not be too complicated: separate the steps,
> reverse their order, for each step add +inv (or remove +inv if already
> present), and reconcatenate them.
> (with PROJ master, you'd need also to change +omit_fwd to +omit_inv and
> +omit_inv to +omit_fwd)
>
> If you just want to apply the reverse operation on coordinates, you can call
> proj_trans()/proj_trans_array()/etc. with direction = PJ_INV instead of PJ_FWD

That's was the fallback option. I'll use that instead of the
potentially fragile proj string parsing/mangling.

Nyall


More information about the PROJ mailing list