Renders a polyline with width fixed in meters, not in pixels. This means that the line width changes whenever zoom level changes. Handy to denote geographic corridors: ranges of specified width around a polyline.
Tested with Leaflet 0.7.1 or newer
Using leaflet-corridor plugin is very easy.
leaflet-corridor.js
file in your project.<script src="https://github.com/mikhailshilkov/leaflet-corridor/raw/master/..path-to-files.../leaflet-corridor.js"></script>
// Create polyline coordinates
var coords = [
L.latLng(-44.696476, 169.13693),
L.latLng(-44.69764, 169.134602)
// ...
];
// Define corridor options including width var options = { corridor: 1000, // meters className: 'route-corridor' };
// Create a corridor and add to the map var corridor = L.corridor(coords, options); map.fitBounds(corridor.getBounds()); map.addLayer(corridor);
### Parameters
| Parameter | Description
| ----------------- | ----------------------
| latlngs | Array of L.latLng to define polyline coordinates
| options.corridor | Width of the corridor in meters
| options.* | Options for polyline rendering, exactly same as in L.polyline
### License
**leaflet-corridor** is free software, and may be redistributed under the MIT-LICENSE.