[PROJ] Proj6 Docs

Even Rouault even.rouault at spatialys.com
Sat Feb 16 14:24:20 PST 2019


On samedi 16 février 2019 23:13:56 CET Even Rouault wrote:
> > > Perhaps I should since the above explanation are probably
> > > just an implementation detail for your use case ?
> 
> OK, fix just pushed.
> 
> > Yes, I’m only looking for source/target so I can figure out if I need to
> > do
> > an axis swap before (or after) feeding the transformation. Is there a
> > decent way to stick a swap directing onto the end/start of the
> > transformation so I get it “for free” when I run proj_trans?
> 
> That would involve hand editing the pipeline.
> 
> proj_as_proj_string(ctx, P, PJ_PROJ_5, nullptr) will return a PROJ string
> that generally begin with "+proj=pipeline" (not in your case with
> alternatives though)
> 
> If just after that and before the first +step, you insert
> 
> +step +proj=axisswap +proj=axisswap +order=2,1
> 
> (or you append it at the end if you want to reverse the order for the
> output)
> 
> And then you can recreate a PJ pipeline with that string with proj_create()
> 
> Or course if you do an axisswap just before/after another one, their effect
> cancels each other, so you could optimize by removing it;

Another option is that you alter your source/target CRS to have the axis order 
you wish.

In proj_experimental.h, you have functions to do CRS manipulations

For example if you start with a geographic CRS PJ* geogCRS, you could do:


PJ* datum = proj_crs_get_datum(geogCRS);
PJ* long_lat_cs = proj_create_ellipsoidal_2D_cs(ctx,
														  PJ_ELLPS2D_LONGITUDE_LATITUDE,
														  "Degree",
														  180.0 / M_PI);
PJ* long_lat_crs = proj_create_geographic_crs_from_datum(
	ctx, "my CRS", datum, long_lat_cs);
proj_destroy(datum);
proj_destroylong_lat_cs);

But using that API might be more tricky and have side effects (like area of 
use being lost, which can have effects when datum transformation paths are 
searched. Setting this area of use could be done with the C++ API, but the C 
API is just a subset of it that doesn't expose that), so you'd better do the 
axis swapping game in your code rather than creating those alternative CRS 
definitions.


Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the PROJ mailing list