I'm trying to automate some tasks in Qgis, using the built-in python console. I have around 20 layers with different CRS, which I would all like to have the same one.
I'm not sure how to approach this. The cookbook (https://docs.qgis.org/2.18/en/docs/pyqgis_developer_cookbook/crs.html) only gives information about how to transform a single point, but I assume it will be somewhat similar.
This is from point transformation from the cookbook:
crsSrc = QgsCoordinateReferenceSystem(4326) # WGS 84
crsDest = QgsCoordinateReferenceSystem(32633) # WGS 84 / UTM zone 33N
xform = QgsCoordinateTransform(crsSrc, crsDest)
pt1 = xform.transform(QgsPoint(18,5))
print "Transformed point:", pt1
layer_crs = layer.crs() layer_crs.createFromString("EPSG:32633") layer.setCrs(layer_crs)