This commit is contained in:
Jake Kasper
2025-09-05 12:06:29 -04:00
parent 2b9a54b965
commit e1340a1e50
2 changed files with 49 additions and 21 deletions

View File

@@ -107,7 +107,13 @@ const sanitizePolygon = (coords) => {
} else { return [pts[0], pts[pts.length-1]]; }
};
try { filtered = rdp(filtered, EPS_DEG); } catch {}
return filtered;
// Ensure at least 3 unique points remain; if not, fall back to original coords
const unique = [];
for (const p of filtered) {
if (!unique.some(q => Math.abs(q[0]-p[0])<1e-9 && Math.abs(q[1]-p[1])<1e-9)) unique.push(p);
}
if (unique.length < 3) return coords;
return unique;
};
// @route GET /api/properties