@dra2020/baseclient 1.0.125 → 1.0.127
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { polyIntersects } from './union';
|
|
2
|
-
import { polyArea } from './poly';
|
|
2
|
+
import { polyArea, polyDescribe } from './poly';
|
|
3
3
|
|
|
4
4
|
function flattenMultiPoly(polys: any): any
|
|
5
5
|
{
|
|
@@ -24,6 +24,14 @@ export function featureCleanHoles(f: any): any
|
|
|
24
24
|
|| !Array.isArray(f.geometry.coordinates))
|
|
25
25
|
return f;
|
|
26
26
|
|
|
27
|
+
// Bail out if excessive computation cost (and complex poly likely already correct, heuristically)
|
|
28
|
+
let d = polyDescribe(f);
|
|
29
|
+
if (d.npoly + d.nhole > 10)
|
|
30
|
+
{
|
|
31
|
+
//console.log(`featureCleanHoles: bailing out on polygon with ${d.npoly} polygons and ${d.nhole} holes`);
|
|
32
|
+
return f;
|
|
33
|
+
}
|
|
34
|
+
|
|
27
35
|
// Normalize to flattened polygon
|
|
28
36
|
f.geometry.coordinates = flattenMultiPoly(f.geometry.coordinates);
|
|
29
37
|
|