Le 07/03/2023 à 17:08, Edzer Pebesma a écrit :
Thanks, Even!

I was after the units of the horizontal coordinates; GetLinearUnits() returns "unknown" for EPSG:4326 and, according to the docs returns the units of the vertical coordinate in 3D CRS (didn't check). So what I now use is GetAttrValue("UNIT", 0) (which returns "degree" for EPSG:4326"), and if that returns NULL, use GetLinearUnit(&unit) if its value differs from "unknown".

Try:

if( srs->IsGeographic() )
   srs->GetAngularUnits(&unit);
else

  srs->GetLinearUnits(&unit);


--
http://www.spatialys.com
My software is free, but my time generally not.

_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to