calvinmetcalf / shapefile-js

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

Shapefile crossing the antimeridian converted incorrectly #79

Closed audreyhession closed 2 years ago

audreyhession commented 7 years ago

I have a shapefile containing a polygon that crosses the antimeridian. Shapefiles determine the interior of a polygon by the order of vertices, specifically, the exterior ring vertices are in clockwise order. (http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf page 8) GeoJSON doesn't follow any particular vertex ordering, thus to indicate antimeridian crossing, the polygon should be split on the 180 degree line. (https://tools.ietf.org/html/rfc7946#section-3.1.9)

example.zip

shapefile

geojson

calvinmetcalf commented 7 years ago

thanks, once Turfjs/turf#580 is merged I should be able to easily split both lines and polygons