Leaflet plugin to render geographic corridors
Yesterday I’ve published a simple Leaflet plugin called
leaflet-corridor.
The plugin defines a new Leaflet primitive L.Corridor
.
When initialized with an array of geo points and width, it renders a polyline with width fixed in meters, not in pixels. That means that line width changes whenever zoom level changes.
The plugin is handy to denote geographic corridors: ranges of specified width around a polyline. In our project we used it to show a predefined vehicle route from Origin to Destination, with only limited allowed violation from this predefined route. Whenever vehicle’s position falls out of this corridor, the event of Out-of-corridor violation is recorded and shown on the map.
Here are all the links for the corridor plugin:
- Github repository with source code, documentation and usage example
- Demo page to try it out
- Stackoverflow question which inspired me to open-source the implementation
comments powered by Disqus