feat: area of country

This commit is contained in:
Artemy 2023-06-13 13:53:51 +03:00
parent 2ee6f3ab7d
commit dd3b75fb6d
3 changed files with 35 additions and 0 deletions

View file

@ -5,6 +5,8 @@ import {
InspectControl,
} from "mapbox-gl-controls";
import area from "@turf/area";
function loginfo(...str) {
let info = str.shift();
console.log(
@ -253,6 +255,14 @@ window.onload = async () => {
: ""
}
</div>
<div class="col-12 text-center glass">
Area: ${(area(feature) / 1000000)
.toFixed(2)
.replace(
/(\d)(?=(\d\d\d)+([^\d]|$))/g,
"$1 "
)} km²
</div>
<div class="col-12 text-center mt-2">
${
country.about