Answer the question
In order to leave comments, you need to log in
How to get GeoJson from layer in Leaflet?
Something I just can't figure out. Let's say the user draws a polygon. Then it needs to be saved as a GeoJson.
I do according to examples from the Internet:
drawnItems = new L.FeatureGroup();
drawnItems.addLayer(layer);
myjson = drawnItems.toGeoJSON();
console.log(myjson)
However, in the console I see:
Object {__ob__: Observer}
img.ctrlv.in/img/16/09/28/57ebd08e2aece.png
How can I extract GeoJSON itself from here with coordinates?
Ideally, just coordinates in WKT format. As I understand it, here the JS object itself is persistently given to me.
Here is an example https://bl.ocks.org/danswick/d30c44b081be31aea483
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question