calvinmetcalf / shapefile-js

Convert a Shapefile to GeoJSON. Not many caveats.
http://calvinmetcalf.github.io/shapefile-js/
715 stars 228 forks source link

Fixes parsing of null shapes #141

Closed yakomaru closed 3 years ago

yakomaru commented 3 years ago

Fixes #134

The current implementation skips over null shapes in shapefiles resulting in a mismatch between shape data in .shp and .dbf files.

This fix parses null shapes as empty coordinate polygons instead of skipping them to maintain the 1 to 1 relationship between the shape data in the two files.

Example with badshp.zip on http://leaflet.calvinmetcalf.com/#6/-33.596/138.076 Before fix:

90097530-fccd6a80-dcea-11ea-90fc-886215d24467

After fix:

Screen Shot 2020-10-20 at 7 02 48 PM
calvinmetcalf commented 3 years ago

I think we want to put a null here not an empty polygon object, that'll be more compatable with things like null lines etc. I double checked the spec and I believe that's what you are supposed to do.

yakomaru commented 3 years ago

Yeah, that makes more sense. I updated the pull request.

calvinmetcalf commented 3 years ago

v2.6.2