mirror of
https://github.com/CIMEngine/map.git
synced 2024-11-22 02:46:22 +03:00
feat: area of country
This commit is contained in:
parent
2ee6f3ab7d
commit
dd3b75fb6d
3 changed files with 35 additions and 0 deletions
24
package-lock.json
generated
24
package-lock.json
generated
|
@ -9,6 +9,7 @@
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@turf/area": "^6.5.0",
|
||||||
"mapbox-gl-controls": "^2.3.5"
|
"mapbox-gl-controls": "^2.3.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -195,6 +196,18 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@turf/area": {
|
||||||
|
"version": "6.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@turf/area/-/area-6.5.0.tgz",
|
||||||
|
"integrity": "sha512-xCZdiuojokLbQ+29qR6qoMD89hv+JAgWjLrwSEWL+3JV8IXKeNFl6XkEJz9HGkVpnXvQKJoRz4/liT+8ZZ5Jyg==",
|
||||||
|
"dependencies": {
|
||||||
|
"@turf/helpers": "^6.5.0",
|
||||||
|
"@turf/meta": "^6.5.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://opencollective.com/turf"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@turf/distance": {
|
"node_modules/@turf/distance": {
|
||||||
"version": "6.3.0",
|
"version": "6.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@turf/distance/-/distance-6.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/@turf/distance/-/distance-6.3.0.tgz",
|
||||||
|
@ -223,6 +236,17 @@
|
||||||
"url": "https://opencollective.com/turf"
|
"url": "https://opencollective.com/turf"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@turf/meta": {
|
||||||
|
"version": "6.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@turf/meta/-/meta-6.5.0.tgz",
|
||||||
|
"integrity": "sha512-RrArvtsV0vdsCBegoBtOalgdSOfkBrTJ07VkpiCnq/491W67hnMWmDu7e6Ztw0C3WldRYTXkg3SumfdzZxLBHA==",
|
||||||
|
"dependencies": {
|
||||||
|
"@turf/helpers": "^6.5.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://opencollective.com/turf"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/estree": {
|
"node_modules/@types/estree": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.1.tgz",
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
"rollup-plugin-copy": "^3.4.0"
|
"rollup-plugin-copy": "^3.4.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@turf/area": "^6.5.0",
|
||||||
"mapbox-gl-controls": "^2.3.5"
|
"mapbox-gl-controls": "^2.3.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
10
src/index.js
10
src/index.js
|
@ -5,6 +5,8 @@ import {
|
||||||
InspectControl,
|
InspectControl,
|
||||||
} from "mapbox-gl-controls";
|
} from "mapbox-gl-controls";
|
||||||
|
|
||||||
|
import area from "@turf/area";
|
||||||
|
|
||||||
function loginfo(...str) {
|
function loginfo(...str) {
|
||||||
let info = str.shift();
|
let info = str.shift();
|
||||||
console.log(
|
console.log(
|
||||||
|
@ -253,6 +255,14 @@ window.onload = async () => {
|
||||||
: ""
|
: ""
|
||||||
}
|
}
|
||||||
</div>
|
</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">
|
<div class="col-12 text-center mt-2">
|
||||||
${
|
${
|
||||||
country.about
|
country.about
|
||||||
|
|
Loading…
Add table
Reference in a new issue