Compare commits

...

2 Commits

1 changed files with 10 additions and 5 deletions

View File

@ -30,12 +30,17 @@ import { generateUUID } from "../src/tool";
//对多边形进行判断,切割外的多边形丢弃
// let innerPolygons = polygonCollection.features.filter(polygon => {
// let center = turf.centroid(polygon);
// return turf.booleanWithin(center, outerPolygon);
// });
let innerPolygons = polygonCollection.features.filter(polygon => {
// 获取多边形质心 多边形不规则时有问题
// let center = turf.centroid(polygon);
let innerPolygons = polygonCollection.features;
// 获取多边形表面一点
let newcenter = turf.pointOnFeature(polygon);
return turf.booleanWithin(newcenter, outerPolygon);
});
// let innerPolygons = polygonCollection.features;
//处理镂空数据多处镂空数据会导致计算错误因为polygonize方法无法正常的返回数据