Skip to main content

Utils

Utils

The following methods are available on L.PM.Utils:

MethodReturnsDescription
calcMiddleLatLng(map, latlng1, latlng2)LatLngReturns the middle LatLng between two LatLngs.
getTranslation(path)StringReturns the translation of the passed path. path = json-string f.ex. tooltips.placeMarker.
findLayers(map)ArrayReturns all layers that are available for Leaflet-Geoman.
circleToPolygon(circle, sides = 60, withBearing = true)PolygonConverts a circle into a polygon with default 60 sides. For CRS.Simple maps withBearing needs to be false.
pxRadiusToMeterRadius(radiusInPx, map, center)NumberConverts a px-radius (CircleMarker) to meter-radius (Circle). The center LatLng is needed because the earth has different projections on different places.
getMeasurements(layer, map, displayFormat)ObjectCalculate the measurements of any layer. The option displayFormat can be metric or imperial.