Re: Reversing a coordinate operation via proj api

Nyall Dawson <[email protected]> Fri, 13 Dec 2019 10:06:19 +1000
Newsgroups gmane.comp.gis.proj-4.devel
Message-ID <CAB28AsiJ9kEwLm=kvO+UWuGjDQ3NBTZbR9t-m7vr3b3d9gJADg@mail.gmail.com>
On Fri, 13 Dec 2019 at 09:55, Even Rouault <[email protected]> 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
_______________________________________________
PROJ mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/proj