mirror of
https://github.com/CIMEngine/cimengine-build-tools.git
synced 2024-11-24 21:06:23 +03:00
fix: polygon area
This commit is contained in:
parent
98f9f5ae72
commit
a0ec2ef415
3 changed files with 4 additions and 4 deletions
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "cimengine-build-tools",
|
||||
"version": "1.3.1",
|
||||
"version": "1.3.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "cimengine-build-tools",
|
||||
"version": "1.3.1",
|
||||
"version": "1.3.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@turf/turf": "^6.5.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "cimengine-build-tools",
|
||||
"version": "1.3.1",
|
||||
"version": "1.3.2",
|
||||
"description": "Geojson data processing tools for CIMEngine",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
|
|
@ -385,7 +385,7 @@ console.time("Set new ids and area");
|
|||
let id = 0;
|
||||
geo.features = geo.features.map((val) => {
|
||||
val.id = id++;
|
||||
if (val.geometry.type === "MultiPolygon") {
|
||||
if (val.geometry.type.endsWith("Polygon") && !val.properties.type) {
|
||||
val.properties.area = (turf.area(val) / 1000000)
|
||||
.toFixed(2)
|
||||
.replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, "$1 ");
|
||||
|
|
Loading…
Add table
Reference in a new issue