-1

I am working with a layer created from a csv file, upload it by means of python.

Now I need to save the layer that is loaded with the points like a ShapeFile.

Do you know if this is possible and how it is possible?

1
  • 1
    Welcome to gis.stackexchange! Please note that a good question on this site is expected to show some degree of research on your part, i.e. what you have tried and - if applicable - code so far. For more info, you can check our faq.
    – underdark
    Commented Nov 6, 2018 at 18:27

1 Answer 1

5

If you are using PyGIS you can save the layer as Shapefile in the following way.

import processing
from processing.core.Processing import Processing
Processing.initialize()

layer.selectAll()
path_shp = '/home/grand/Desktop/layer_name.shp'
processing.run("native:saveselectedfeatures", {'INPUT':layer,'OUTPUT':path_shp})
layer.removeSelection()
2
  • Which libraries should have been imported? Commented Nov 6, 2018 at 16:54
  • you should import the processing module. Commented Nov 6, 2018 at 18:09

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