3

I'm new to PyQGIS and trying to save the output of the processing tool 'create points layer from table'. I just need to save it as a shapefile. My code is below which seems to be functioning so far. Using QGIS v3.4.

params = { 'INPUT' : 'C:/Users/xxx/WeeklyContacts-2019年07月15日.csv', 'MFIELD' : None, 'OUTPUT' : 'memory:', 'TARGET_CRS' : QgsCoordinateReferenceSystem('EPSG:27700'), 'XFIELD' : 'Easting', 'YFIELD' : 'Northing', 'ZFIELD' : None }
processing.run("qgis:createpointslayerfromtable", params)
PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Jul 22, 2019 at 16:06

1 Answer 1

5

Your 'OUTPUT' parameter is 'memory:'. That means once the processing finishes, you will get a temporary memory layer. Change it to a shapefile and a shapefile will be saved to the disk.

params = { 'INPUT' : 'C:/Users/xxx/WeeklyContacts-2019年07月15日.csv', 'MFIELD' : None, 'OUTPUT' : 'C:/Users/xxx/WeeklyContacts-2019年07月15日.shp', 'TARGET_CRS' : QgsCoordinateReferenceSystem('EPSG:27700'), 'XFIELD' : 'Easting', 'YFIELD' : 'Northing', 'ZFIELD' : None }
processing.run("qgis:createpointslayerfromtable", params)
answered Jul 22, 2019 at 16:26

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.