GeospatialPython / pyshp

This library reads and writes ESRI Shapefiles in pure Python.
MIT License
1.09k stars 259 forks source link

How to modify the shape value #252

Open mshmoon opened 1 year ago

mshmoon commented 1 year ago

What's your question?

I want to modify the shape value directly, by using sf.shape(i).points = [[xx,xx]],but it is nothing useful

karimbahgat commented 1 year ago

Pyshp currently does not allow direct editing of files. As you mention, modifying a shape read from a shapefile with Reader will therefore only modify the shape loaded into memory, not the actual file. If you want to edit the shapes, you would read in shapes with a Reader, edit them, then write them to a new shapefile with a Writer. The Readme has an example of this: https://github.com/GeospatialPython/pyshp#editing-shapefiles