Saturday, 27 October 2018

coordinate system - Setting CRS in QGIS using PyQGIS?


This question is very similar to How to define layer's CRS and avoid the CRS dialog in PyQGIS?, but it's doesn't work for me.


This is my try:


vlayer.setCrs(QgsCoordinateReferenceSystem(25830))

iface.mapCanvas().mapRenderer().setDestinationCrs(QgsCoordinateReferenceSystem(25830))

But the dialog pop up asking for CRS to choose, and when I ask for the CRS of the layer, it show a diferent CRS:


print "CRS: " + vlayer.crs().geographicCRSAuthId()

It show CRS: EPSG:4258 and It must be 25830




No comments:

Post a Comment