Skip to content

Latest commit

 

History

History
53 lines (39 loc) · 1.23 KB

README.md

File metadata and controls

53 lines (39 loc) · 1.23 KB

leaflet-measure-distance NPM version NPM Downloads

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.

Example use:

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.

License

CSIRO Open Source Software Licence Agreement (variation of the BSD / MIT License)