计算图斑分割面积
parent
db875e9116
commit
78fde874f6
|
|
@ -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);
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue