[PROJ] Equivalent of OSRSetFromUserInput in proj 6 API

Even Rouault even.rouault at spatialys.com
Mon Apr 8 02:42:11 PDT 2019


On lundi 8 avril 2019 19:32:23 CEST Nyall Dawson wrote:
> On Mon, 8 Apr 2019 at 18:15, Even Rouault <even.rouault at spatialys.com> 
wrote:
> > On lundi 8 avril 2019 13:18:07 CEST Nyall Dawson wrote:
> > > Hi list,
> > > 
> > > While plugging away at the QGIS proj 6 upgrade I came across code
> > > which uses OSRSetFromUserInput in order to convert any freeform string
> > > to a coordinate reference system object.
> > > 
> > > Is there an equivalent of this in the proj 6 API I should be using
> > > instead of this?
> > 
> > proj_create() will be able to handle PROJ strings, WKT, AUTH:CODE, OGC
> > URNs
> > and CRS names (like 'WGS84')
> > 
> > If you pass it a PROJ string that needs to be interpretated as a CRS, you
> > need to add " +type=crs" to it, otherwise it will be interpretated as a
> > coordinate operation.
> 
> Is there any way use proj_create with an EPSG code, but restrict the
> results to CRS objects only (for those duplicate codes)?
> 

Use proj_create(ctx, "urn:ogc:def:crs:EPSG::XXXX")

or proj_create_from_database(ctx, "EPSG", "XXXX", PJ_CATEGORY_CRS, false, 
nullptr)

Even

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


More information about the PROJ mailing list