mikhailshilkov / leaflet-corridor

Leaflet plugin to draw a polyline with fixed width in meters
MIT License
34 stars 9 forks source link

leaflet-corridor

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.

Leaflet-corridor screenshot

Tested with Leaflet 0.7.1 or newer

Demo

Live demo

Getting started

Using leaflet-corridor plugin is very easy.

Usage

// 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.