Map features
Measure
Distance and area, computed on the sphere rather than in map pixels — the difference is about 50 % at Austrian latitudes, which is the sort of error nobody notices until it matters.
Try it: the ruler button in the control stack. Click to set points, drag a point to adjust it, double-click to finish. Backspace removes the last point, Esc clears. Switch to Area for a polygon with its perimeter.
Why spherical maths
MapLibre renders Web Mercator, where a pixel covers less ground the further north you go. Measuring in projected coordinates would overstate distances in Austria by roughly the secant of the latitude — a 1 km walk near Vienna would read as about 1.5 km.
map0 measures with the haversine formula for lengths and the spherical excess of the polygon for areas. Both are within about half a percent of full ellipsoidal values, which is well below the precision of clicking on a map.
- Segment labels while drawing, plus a running total at the last point
- Area mode reports the enclosed area and the perimeter
- Units follow the magnitude: m → km, m² → ha → km²; decimals follow the UI locale
- Vertices stay draggable after finishing, and the numbers update live
How it is drawn
The measurement is ordinary MapLibre style layers — a white casing beneath a coloured line so it stays readable on aerial imagery, dashed while a segment is still following the cursor, and vertices as circles in the theme's accent colour. Switch the basemap to Aerial mid-measurement: the geometry survives the style change like any other overlay.
Configuration
One key. It is on by default; false removes the control entirely.
Scope
This is measuring, not drawing: no shapes to keep, no annotation model, nothing that ends up in the share link. If map0 ever grows real annotations, Terra Draw is the right dependency for that job — and this module can stay exactly as it is, because measuring a distance and authoring a drawing are different tasks that happen to look similar.