New StackOverflow Question: The GeoJSON string of shapefile while using *.toGeoJSON() is incomplete in Mapbox

5 views
Skip to first unread message

stacko...@mg.bodar.com

unread,
Mar 7, 2017, 5:10:41 AM3/7/17
to total...@googlegroups.com

The GeoJSON string of shapefile while using *.toGeoJSON() is incomplete in Mapbox

Asked by Raj on 2017-01-26T22:12:55Z

Reply on StackOverflow

I'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
Reply all
Reply to author
Forward
0 new messages