--- layout: example.html title: Measure using vector styles shortdesc: Example of measuring lengths and areas using vector styles. docs: >

Using vector styles instead of overlays makes it easy to set up, then modify and clear a measure. Additional information such as the lengths of individual segments or sides can be included as required.

The `getLength()` and `getArea()` functions calculate spherical lengths and areas for geometries. Lengths are calculated by assuming great circle segments between geometry coordinates. Areas are calculated as if edges of polygons were great circle segments.

Note that the `geometry.getLength()` and `geometry.getArea()` methods return measures of projected (planar) geometries. These can be very different than on-the-ground measures in certain situations — in northern and southern latitudes using Web Mercator for example. For better results, use the functions in the `ol/sphere` module.

tags: "draw, edit, measure, modify, style, vector" ---
Measurement type
Show segment lengths: Clear previous measure: