Mercurial > gemma
changeset 1067:3f14b73414e2
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²
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Fri, 26 Oct 2018 09:35:43 +0200 |
parents | 7ec2133c6404 |
children | c933665b0193 |
files | client/src/map/Maplayer.vue |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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());