r-spatial / mapedit

Interactive editing of spatial data in R
https://www.r-spatial.org/r/2019/03/31/mapedit_leafpm.html
Other
218 stars 33 forks source link

feature request: snap to vertex #15

Open mdsumner opened 7 years ago

mdsumner commented 7 years ago

My first enhancement request is for drawing/edit snap-mode, so that we can align segment-based shapes to existing vertices. Snap is illustrated here:

http://makinacorpus.github.io/Leaflet.Snap/

Because we can upload point layers already this will also allow a way to draw exacting shapes if we want that for demonstrations, and more importantly to create simple features layers that are topologically sound as a network.

I'm really interested to explore the igraph connection:

https://gist.github.com/timelyportfolio/94c44959cf73e96a12ee2e194aaaaf2a

and this will be useful for leveraging TopoJSON as well.

tim-salabim commented 7 years ago

Thanks for the link! That was on my mind to research too at some stage. And I agree that this is essential for all sorts of things

timelyportfolio commented 7 years ago

The new leaflet.pm will be a good option once we get to Leaflet >1.0.

mdsumner commented 7 years ago

Yeah nice! https://codeofsumit.github.io/leaflet.pm/

Imagine what editing with live topojson arcs could be like. (I'm going to have to get serious about .js one of these days).

tim-salabim commented 6 years ago

https://github.com/codeofsumit/leaflet.pm has progressed quite a bit since last year. It now also allows for creation/deletion of holes in polygons & splitting of polygons by polygon. In light of @bhaskarvk 's retirement from spatial work, I think we should consider wrapping leaflet.pm in mapedit. With https://github.com/ropensci/lawn we should have access to all (most) truf.js modules and could maybe even provide more tools for feature editing. In any case, I feel that snapping should be the default behaviour when drawing features on a map. @timelyportfolio what are your thoughts on including leaflet.pm?

tim-salabim commented 6 years ago

Also, I haven't found anything in the leaflet.draw documentation on how to enable snapping... I only see the example which only seems to have snapping enabled for the red line.