Skip to content

Map add-ons: markers, controls, measuring, routing

Choose a tag to compare

@github-actions github-actions released this 10 Nov 22:31
· 70 commits to main since this release

Optional map add-ons, 1-2 KB gzipped each. Add-ons reach the map through element.crootjsMap instead of importing map.js, so a page loading map.min.js never gets a second copy.

  • mapmarker.js - addMarker: pin, image icon or your own element, with label, popup and dragging (onDragEnd).
  • mapcontrol.js - addScaleBar, locateUser, addLocateButton.
  • geomeasure.js - getDistance, getLength, getArea, isInside, getFeaturesAt, getNearest, createCircle (same sphere as Turf.js, so the numbers match).
  • georoute.js - findRoute: shortest route along the LineStrings of your own GeoJSON, computed in the browser, with endpoints snapped to the nearest line.

map.js gains onMapMove, getMapBounds, mapToPoint / pointToPosition, and addMapControl for your own element in a map corner.