Skip to content

CallumNZ/leaflet.measure

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

Adds interactive distance measuring to leaflet

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 80.2%
  • CSS 10.0%
  • HTML 9.8%