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.

1 Answer 1


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 and acknowledge you have read our privacy policy.

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