diff --git a/src/Controller/MapsController.php b/src/Controller/MapsController.php index 95b37a0..33da754 100644 --- a/src/Controller/MapsController.php +++ b/src/Controller/MapsController.php @@ -53,10 +53,18 @@ class MapsController private function formatMapAreaForHuman(float $area): array { - if ($area < 100000.0) { + if ($area < 100.0) { $digits = 0; $rounded = round($area, 0); $unit = 'm'; + } elseif ($area < 100000.0) { + $digits = 0; + $rounded = round($area, -2); + $unit = 'm'; + } elseif ($area < 1000000.0) { + $digits = 2; + $rounded = round($area / 1000000.0, 2); + $unit = 'km'; } elseif ($area < 100000000.0) { $digits = 0; $rounded = round($area / 1000000.0, 0);