makinacorpus / Leaflet.FileLayer

Loads files locally (GeoJSON, KML, GPX) as layers using HTML5 File API
http://makinacorpus.github.io/Leaflet.FileLayer/
MIT License
270 stars 91 forks source link

Make Leaflet.FileLayer directly compatible with Leaflet.Draw and provide simple example. #38

Open spydmobile opened 7 years ago

spydmobile commented 7 years ago

Thanks for this amazing component, its fast and I love it, however I have spent many hours trying to get draw to edit my GPX uploads with no success yet. Close but no success. My use case is that my field techs are uploading a GPS track (GPX LineString) which is actually a wildfire boundary so it needs to be edited and closed into a polygon in the mapplication. I have tried a multitude of approaches including loading in turfJS and using custom Turf Script to convert the GeoJson LineString to a bonifide Polygon, but then I am unable to load the result into draw for editing. Would be so sweet to just have these two awesome components work together out of the box somehow.

spydmobile commented 7 years ago

I now have this working but it involved converting the geojson from the GPX using turf and then feeding it back to the draw module. Not sure there is anything for you to do.

leplatrem commented 7 years ago

It would be awesome if you could contribute a small demo of what you've done! (in an examples/ folder here for example)

spydmobile commented 7 years ago

In theory a great idea, in practice however, a lot of work to extract the realavant code from my gong-show, but I will put it on my todo list ;-)

suseday commented 7 years ago

Oh I would LOVE to see how to edit the points and tracks (uploaded with FileLayer) in Leaflet.Draw. I too tried to import so that the elements can be edited but I gave up :-( So I would love to see how it works. My assumption is/was that FileLayer just need to draw the elements to the Leaflet.Draw FeatureGroup var drawnItems = L.featureGroup().addTo(map);

I guess they can then be edited if the elements are in that FeatureGroup. But how to get them into it? I have no idea :-(

btw: Great Plugin! Thank you!