3

I am generating some maps with the python standalone scripting in QGIS. When i load Polygon shapefile with the CH1903 / LV03 CRS ( EPSG-21781) and fetching SQL database table having WGS1984 CRS (EPSG-4326) sequence of Layers are as follows

  1. Polygon Shapefile ( CH1903 / LV03 CRS -EPSG-21781)
  2. SQL Database table (WGS1984 CRS -EPSG-4326)
  3. Output Map units is in CH1903 / LV03 CRS -EPSG-21781 for Manually added layers
  4. Output Map units is in WGS1984 CRS -EPSG-4326) for standalone script with same shapefile and same data.

Now my question is how to change CRS transformation in standalone script where i will get correct output in the form of CH1904 CRS after loading shapefile and point layer data from SQL database.

1 Answer 1

1

You may change the CRS of a layer using qgis reprojection algorithm qgis:reprojectlayer algorithm like this:

reproject=processing.runalg('qgis:reprojectlayer',layer,'EPSG:32630',None)

You're not obligated to save the output layer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.