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.

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.

Labels are DOM markers, not text layers A symbol layer would need a glyph source from the basemap style, which raster basemaps do not have — a measurement over an orthophoto would simply show no numbers. Markers are styled with the same CSS tokens as the rest of the interface instead.

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.