makinacorpus/Leaflet.PolylineHandles

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

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Leaflet.PolylineHandles

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:

Usage

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();
});
Events
Authors

Makina Corpus

This was first implemented in the Geotrek project by Simon Thépot.

It is greatly inspired by OSM Routing machine and Google Maps.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.