分割问题质心点修改
parent
7705cf608d
commit
712eb987a3
|
|
@ -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方法无法正常的返回数据)
|
||||
|
|
|
|||
Loading…
Reference in New Issue