-
Notifications
You must be signed in to change notification settings - Fork 997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Leaflet.draw generated a geojson which is not valid #731
Comments
So
|
Mmmh strange. Fab |
Ok got it...
This function doesn't work with a layer (polygon) drawed by leaflet-draw because there is no feature.geometry.type. To fix it I've added The original issue is in fact: no feature.geometry.type on layer object generated by leaflet-draw. I don't know if it is a defect from leaflet-draw or it's a correct behavior. Maybe Have you an idea of the change maybe between features/geojson management in leaflet <1.0 and >=1.0 ? Fab |
Hey @fab-girard, A Feature geometry does seem to have a geometry.type when using toGeoJson,
I'm curious if you are losing the type somewhere between toGeoJSON and your isPoly call? Since I don't have more information I can't really tell? |
To begin: thanks for your support. Now I'm thinking the
But maybe I'm wrong another time... Maybe the layer created by leaflet-draw is not correct and should return true for |
@fab-girard Try looking at the feature group you are adding to instead...
Rather than referencing the event, this featureGroup returns a FeatureCollection with a different structure. |
Hello,
I'm reporting a bug but I'm not sure it's a bug in leaflet.draw or leaflet.
How to reproduce
. create or update a polygon with leaflet.draw
. use .toGeoJSON() on the feature created/updated
=> the json hasn't the
"type": "Feature"
key/value. Geojson is incorrect.What behaviour I'm expecting and which behaviour I'm seeing
=> geojson should be valid with type key
Minimal example reproducing the issue
I've created jsfiddle to reproduce the problem (geojson is displayed under the map when you create/update the draw).
Thanks,
Fabien
The text was updated successfully, but these errors were encountered: