2

Somehow, my attempt at setting the QGIS project coordinate reference system to a Sinusoidal projection by defining the CRS' EPSG ID returns Invalid CRS!.

crs = 54008 # World Sinusoidal Projection

# Set project coordinate reference system (CRS)
spatRef = QgsCoordinateReferenceSystem(crs, QgsCoordinateReferenceSystem.EpsgCrsId)

if spatRef.isValid():
    print("CRS Description: {}".format(spatRef.description()))
    print("CRS PROJ text: {}".format(spatRef.toProj4()))
    QgsProject.instance().setCrs(spatRef)
else:
    print("Invalid CRS!")

I use the long-term QGIS version 3.10.3 on Windows.

1 Answer 1

3

From a quick look at the documentation it appears that your crs code should be EPSG:54008.

However, looking at http://epsg.io/54008 - indicates that it is an ESRI code not EPSG so you may need to use

crs = "proj:+proj=sinu +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs"

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.