[PROJ] Getting "proj" and "datum" for a CRS

Even Rouault even.rouault at spatialys.com
Fri May 3 00:11:26 PDT 2019


On vendredi 3 mai 2019 11:37:58 CEST Nyall Dawson wrote:
> Hi list,
> 
> Next question:
> 
> If I have a crs created from a proj string like:
> 
> +proj=tmerc +lat_0=0 +lon_0=102 +k=0.9999 +x_0=500000 +y_0=0 +ellps=WGS84
> +units=m +no_defs +type=crs
> 
> 1. How can I get the "tmerc" acronym from the proj API? If I
> call proj_crs_get_coordoperation and
> then proj_coordoperation_get_method_info I can retrieve the method name,
> but this is a long version of this value (ie. ."Transverse Mercator", not
> the tmerc acronym)
> 
> 2. How can I get the ellipsoid/datum value? Again, I can
> call proj_get_ellipsoid to get an ellipsoid, and from that I've been
> using proj_get_id_auth_name/proj_get_id_code. But this only sometimes gives
> a value, and ideally I'm trying to retrieve the "WGS84" value used in the
> original proj string.
> 
> (I'm trying to use the official proj methods to retrieve these values -
> without resorting to regex parsing)

As Kristian said, there's no such methods.

> 
> 3. Using proj_as_proj_string sometimes results in errors like:
> "proj_as_proj_string: Unsupported conversion method: Lambert Conic
> Conformal (West Orientated)". I'm guessing this indicates that there's NO
> way of representing that projection using proj strings, and I'm wasting my
> time if I try to work around this?

Yes, there are a few projection methods in the EPSG dataset which aren't 
supported by PROJ

Even

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


More information about the PROJ mailing list