[Proj] Pipeline +init files, inverse

Kristian Evers kreve at sdfe.dk
Wed Feb 21 16:35:15 EST 2018


Steve,

> On 21 Feb 2018, at 22:18, stevejking <stevejking at talktalk.net> wrote:
> 
> Is it possible to use a +init pipeline file in reverse?
> 

Yes. Well, mostly anyway. As long as a reverse path through pipeline exists. Some projections are only defined in the
forward direction, but that is not a problem for you here.

Below I assume you init-file is called “transforms”. You have several options:

1. Do an inverse transformation with cct:

	cct -i +init=transforms:7709-3D

2. Reverse the pipeline by using a global +inv flag:

<7709-3D>   +proj=pipeline +inv \
                     +step +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717+x_0=400000 +y_0=-100000 +ellps=airy +inv \                     
                     +step +proj=vgridshift +grids=OSGM15_GTX_OSGBtoGRS80.gtx +inv \
                     +step +proj=hgridshift +grids=OSTN15_NTv2_OSGBtoETRS.gsb

Note the “+inv” in the first line. Any parameters specified AFTER proj=pipeline and BEFORE the first +step are global
and are added internally to each individual step in the pipeline. This is often useful for ellipsoid specification for instance.
If you +inv a step that is already +inv’ed you effectively get a double-negation which is just the forward operation. This
works for any number of +inv’s. An odd number of +inv’s results in a reverse step, and even number results in a forward
step.

3. Create a reverse entry that self-references the init-file:

<7709-3D_reverse>  +proj=pipeline +step +init=transforms:7709-3D +inv

You probably just want to go with the first option, but depending on your use case 2 and 3 can be useful as well.

/Kristian

> For example, with some explanation from Kristian, I now have two
> transformations:
> 
> # OSGB1936 to ETRS89(2)
> <7709-3D>                  -t0 +proj=pipeline \
>                      +step +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717
> +x_0=400000 +y_0=-100000 +ellps=airy +inv \                     
>                      +step +proj=vgridshift
> +grids=OSGM15_GTX_OSGBtoGRS80.gtx +inv \
>                      +step +proj=hgridshift
> +grids=OSTN15_NTv2_OSGBtoETRS.gsb
> 
> # ETRS89 to OSGB1936
> <7709-3D-Reverse>     -t0 +proj=pipeline \                    
>                      +step +proj=hgridshift
> +grids=OSTN15_NTv2_OSGBtoETRS.gsb +inv \ 
>                      +step +proj=vgridshift
> +grids=OSGM15_GTX_OSGBtoGRS80.gtx \ 
>                      +step +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717
> +x_0=400000 +y_0=-100000 +ellps=airy
> 
> 
> The only difference between the two is the reverse order and swapping the
> +inv and 'no inv blanks' on the end of each line. I'm wondering if I need
> two separate transformations?
> 
> If not is it a sensible future development? +init=<...> +reverse ?
> 
> Steve
> 
> 
> 
> --
> Sent from: http://osgeo-org.1560.x6.nabble.com/PROJ-4-f3840930.html
> _______________________________________________
> Proj mailing list
> Proj at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/proj



More information about the Proj mailing list