计算图斑分割面积

dianlixunjian
徐景良 2025-02-27 16:23:24 +08:00
parent db875e9116
commit 78fde874f6
1 changed files with 19 additions and 1 deletions

View File

@ -907,7 +907,19 @@ import { itemProps } from '@/components/Menu/src/props';
splitPolygonForm.value?.splice(currentPolygon.value,1);
splitAfterPolygon.value?.splice(currentPolygon.value,1);
}
let sumArea = 0.0;
e?.forEach((item, index) => {
var polygon = turf.polygon(item.geometry.coordinates);
let are = (turf.area(polygon) / 666.67).toFixed(2);
if(index == e.length-1){
are = (parseFloat(area) - sumArea).toFixed(2);
}
sumArea = sumArea + are;
let form = {
fid: null,
unitname: '',
@ -921,14 +933,18 @@ import { itemProps } from '@/components/Menu/src/props';
yongjiujibennongtian_area: null,
shengtaibaohuhongxian_area: null,
guotukongjianguihua_area: null,
area: null,
area: are,
geom: item,
checked:false,
};
splitPolygonForm.value?.push(form);
splitAfterPolygon.value?.push(form.geom)
});
//
let splitAfterFeatures = {
type: 'FeatureCollection',
@ -936,6 +952,8 @@ import { itemProps } from '@/components/Menu/src/props';
};
splitPolygonForm.value?.forEach((item,idnex)=>{
console.log("item.geom",item.geom);
splitAfterFeatures.features.push(item.geom);
})