@mytec: iter3.5.1 ready for testing
This commit is contained in:
@@ -107,7 +107,10 @@ export default function CoverageBoundary({
|
||||
/**
|
||||
* Compute concave hull boundary path(s) for a set of coverage points.
|
||||
*
|
||||
* maxEdge = resolution * 3 (in km) gives good detail without over-fitting.
|
||||
* Uses adaptive maxEdge based on point count and resolution:
|
||||
* - More points → smaller maxEdge for finer detail
|
||||
* - Larger resolution → larger maxEdge to avoid over-fitting
|
||||
*
|
||||
* Returns multiple paths if hull is a MultiPolygon (disjoint coverage areas).
|
||||
* Falls back to empty if hull computation fails (e.g., collinear points).
|
||||
*/
|
||||
@@ -121,8 +124,17 @@ function computeConcaveHulls(
|
||||
const features = pts.map((p) => point([p.lon, p.lat]));
|
||||
const fc = featureCollection(features);
|
||||
|
||||
// maxEdge in km — resolution * 3 balances detail vs smoothness
|
||||
const maxEdge = (resolutionM * 3) / 1000;
|
||||
// Adaptive maxEdge based on point density:
|
||||
// - Base: resolution * 2 (tighter fit)
|
||||
// - For sparse grids (<100 pts): use larger edge to avoid holes
|
||||
// - For dense grids (>1000 pts): use smaller edge for detail
|
||||
let multiplier = 2.0;
|
||||
if (pts.length < 100) {
|
||||
multiplier = 4.0; // Sparse: wider tolerance
|
||||
} else if (pts.length > 1000) {
|
||||
multiplier = 1.5; // Dense: finer detail
|
||||
}
|
||||
const maxEdge = (resolutionM * multiplier) / 1000;
|
||||
|
||||
try {
|
||||
const hull = concave(fc, { maxEdge, units: 'kilometers' });
|
||||
|
||||
Reference in New Issue
Block a user