Skip to main content

Measurement ⭐

Measurement ⭐

Measurement Demo

Calculates the measurement of a layer while drawing and editing. Exclusive for Leaflet-Geoman Pro ⭐

map.pm.setGlobalOptions({ measurements: { measurement: true, displayFormat: 'metric', ... } })

See the available options in the table below.

OptionDefaultDescription
measurementtrueEnable measurement calculation.
showTooltiptrueShows the tooltip during draw and edit.
showTooltipOnHovertrueShows the tooltip when hovering a finished layer.
displayFormatmetricDisplayed format in the tooltip metric or imperial.
totalLengthtrueShows the total length in the tooltip Line.
segmentLengthtrueShows the segment length in the tooltip Line, Polygon.
areatrueShows the area in the tooltip Polygon, Rectangle, Circle, CircleMarker.
radiustrueShows the radius in the tooltip Circle, CircleMarker.
perimetertrueShows the perimeter in the tooltip Polygon, Rectangle, Circle, CircleMarker.
heighttrueShows the height in the tooltip Rectangle.
widthtrueShows the width in the tooltip Rectangle.
coordinatestrueShows the coordinates in the tooltip Marker, CircleMarker and the current dragged marker while drawing / editing.

The calculated measurements are available on layer.pm.measurements.

You can also calculate measurements of any layer with:

L.PM.Utils.getMeasurements(layer, map, displayFormat); // displayFormat: 'metric' | 'imperial'