Asked by Raj on 2017-01-26T22:12:55Z
Reply on StackOverflowI'm using Mapbox with Leaflet for drawing, editing and removing polygons etc. I'm also using leaflet.shapefile to upload shapefiles and add them to the map.
For a certain application, I need to convert the layer to a GeoJSON object, which I then convert to a JSON string using this code:
var fcgeojson = layer.toGeoJSON();
var fcgeojsonstring = JSON.stringify(fcgeojson);
I have a working version of this in this jsfiddle. And for most of the shapefiles, it works just fine. However, in some cases, like when I use this shapefile, the JSON string of one of the polygons is actually incomplete. You can check out those strings by clicking on the "Test" button in the jsfiddle.
I haven't been able to figure out why this is happening (my guess is maybe the shapefile has too many vertices). Can someone please help me fix this? Please let me know if you need any more details.
Thanks, Rajkishan
Reply on StackOverflow