# HG changeset patch # User Bernhard Reiter # Date 1540539343 -7200 # Node ID 3f14b73414e2438bb0598eed3e79a54bd894d549 # Parent 7ec2133c6404999fd01a4ba0121245326b5b8104 client: correct and improve area measurement * Correct the conversion to km². * Offer m² if we are blow 0.1 km², otherwise round to 1000 m² diff -r 7ec2133c6404 -r 3f14b73414e2 client/src/map/Maplayer.vue --- a/client/src/map/Maplayer.vue Thu Oct 25 23:16:53 2018 +0200 +++ b/client/src/map/Maplayer.vue Fri Oct 26 09:35:43 2018 +0200 @@ -162,7 +162,12 @@ const areaSize = getArea(event.feature.getGeometry()); // also place the a rounded areaSize in a property, // so identify will show it - event.feature.set("area (km²)", Math.round(areaSize) / 1000); + if (areaSize > 100000) { + // convert into 1 km² == 1000*1000 m² and round to 1000 m² + event.feature.set("area (km²)", Math.round(areaSize / 1000) / 1000); + } else { + event.feature.set("area (m²)", Math.round(areaSize)); + } } if (this.drawMode === "LineString") { const length = getLength(event.feature.getGeometry());