0

I would like to retrieve the semi-major axis of ellipsoid of a layer (any layer) using Python API. It seems that crs class can read only the ellipsoid acronym (?) Apparently, QgsDistanceArea class reads all ellipsoid parameters, but I don't know how to use it.

3

With QgsCoordinateReferenceSystem you can also get the WKT(well known text) as QString (using toWkt() ).

You can then parse your WKT to extract the properties of your ellipsoid

<spheroid> ::=
     SPHEROID ["<name>", <semi major axis>, <inverse flattening> ]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.