Geographic Information Systems Asked by aso on August 14, 2021
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.
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"
Answered by Ian Turton on August 14, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP