GeospatialPython / pyshp

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

shpNum shall start from 0 or 1 #151

Closed DeoLeung closed 6 years ago

DeoLeung commented 6 years ago

https://github.com/GeospatialPython/pyshp/blob/master/shapefile.py#L1067

when writing to shp file, the shpNum starts from 0 may cause index problem for some program, like mapnik.

Maybe the shpNum start index could be configurable or it should start from 1

karimbahgat commented 6 years ago

You're right, the shapefile spec says the record numbers begin at 1. This happened because the number was incremented after the number was written. Easy fix by incrementing the number right before, this way the first shape gets index nr 1. See 43582ad58171093a09795858e0700eff84785741.