Measure distances interactively on a leaflet map.
Adds a leaflet control which allows you to activate an interactive mode to measure and annotate distances on the map.
The default units are kilometers, however you can supply an arbitrary scale factor (from meters) and label to support your prefered units.
Default: kilometers
:
const map = new L.Map("map", {
measureControl: {
enabled: true,
},
});
e.g.: nautical miles
:
const map = new L.Map("map", {
measureControl: {
enabled: true,
unitLabel: "nm",
unitFactor: 1852,
},
});
e.g.: meters
:
const map = new L.Map("map", {
measureControl: {
enabled: true,
unitLabel: "m",
unitFactor: 1,
},
});
For a demo see here.
CSIRO Open Source Software Licence Agreement (variation of the BSD / MIT License)