Name: Leaflet.PolylineHandles
Owner: Makina Corpus
Description: Allows to grab intermediary points on a polyline
Created: 2013-09-23 15:13:40.0
Updated: 2017-12-03 16:25:26.0
Pushed: 2013-11-04 14:03:11.0
Homepage: http://makinacorpus.github.io/Leaflet.PolylineHandles
Size: 172
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This plugin allows to grab intermediary points (“handles”) on a polyline, and snap them around the same way you choose intermediary steps on route maps.
Play with online demo.
It requires:
Add default stylesheet leaflet.polylinehandles.css
for handles markers.
Depending on your needs :
Allow handles on one path, and snapping on the same path :
var path = L.polyline(...);
...
map.almostOver.addLayer(path);
path.polylineHandles.addGuideLayer(path);
path.polylineHandles.enable();
Allow handles on one path, and snapping on all paths :
var lines = L.geoJson(...);
var path = lines.getLayers()[0]; // arbitrary
...
map.almostOver.addLayer(path);
path.polylineHandles.addGuideLayer(lines);
path.polylineHandles.enable();
Allow handles on all paths, and snapping on all paths :
var lines = L.geoJson(...);
lines.eachLayer(function (l) {
map.almostOver.addLayer(l);
l.polylineHandles.addGuideLayer(lines);
l.polylineHandles.enable();
});
This was first implemented in the Geotrek project by Simon Thépot.
It is greatly inspired by OSM Routing machine and Google Maps.