-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?

closed as off-topic by PolyGeo Nov 6 '18 at 19:46

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 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 Nov 6 '18 at 18:27
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()
  • Which libraries should have been imported? – Adrian Chamorro Nov 6 '18 at 16:54
  • you should import the processing module. – Leo Cardona Nov 6 '18 at 18:09

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