Saturday 6 July 2019

qgis - How to make crs transformation of a QgsVectorLayer?


I need to transform QgsVectorLayers in python from one crs into another crs. By googling I found the following solution (https://qgis.readthedocs.org/en/latest/docs/pyqgis_developer_cookbook/05_crs.html), which works for points only:


crsSrc = QgsCoordinateReferenceSystem(4326)    # WGS 84
crsDest = QgsCoordinateReferenceSystem(32633) # WGS 84 / UTM zone 33N
xform = QgsCoordinateTransform(crsSrc, crsDest)
pt1 = xform.transform(QgsPoint(18,5))

Is there a way to make a crs transformation of an entire layer?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...