[PROJ] Anyway to set a CRS object's name via c api?

Even Rouault even.rouault at spatialys.com
Fri Oct 9 04:04:35 PDT 2020


Hi Nyall,

> Using the C api "proj_get_name" method I'm able to retrieve the
> descriptive name of a CRS object.
> 
> This works well for CRS obtained from the Proj database, or for CRS
> defined from WKT with a name embedded: ...PROJCRS["my CRS name",
> BASEGEOGCRS[...
> 
> But if I have a CRS object created using a different method (say, from
> a proj string), is there any way I can manually set a name for this
> CRS so that subsequent calls to proj_as_wkt will include the manually
> set CRS name?
> 
> While it would be possible to get the WKT returned from proj_as_wkt
> and then try to insert the custom name, this would be a lot of fragile
> string manipulation which I'd rather avoid!


/** \brief Return a copy of the object with its name changed
 *
 * Currently, only implemented on CRS objects.
 *
 * The returned object must be unreferenced with proj_destroy() after
 * use.
 * It should be used by at most one thread at a time.
 *
 * @param ctx PROJ context, or NULL for default context
 * @param obj Object of type CRS. Must not be NULL
 * @param name New name. Must not be NULL
 *
 * @return Object that must be unreferenced with
 * proj_destroy(), or NULL in case of error.
 */
PJ PROJ_DLL *proj_alter_name(PJ_CONTEXT *ctx, const PJ *obj, const char *name);


Available in proj_experimental.h since 6.0


Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20201009/de50d153/attachment-0001.html>


More information about the PROJ mailing list