Files
lynchmark/tests/11_geospatial/outputs/stealth_union-alpha EFF_high.js
2026-09-16 16:14:56 +00:00

16 lines
532 B
JavaScript

async function analyzeGPS(readings, boundary) {
const { booleanPointInPolygon, lineString, length } =
await import("https://cdn.jsdelivr.net/npm/@turf/turf@7.2.0/+esm");
const points = readings
.filter(({ loc }) => booleanPointInPolygon(loc, boundary, { ignoreBoundary: true }))
.sort((a, b) => a.ts - b.ts)
.map(({ loc }) => loc);
return points.length < 2
? 0
: +length(lineString(points), { units: "kilometers" }).toFixed(2);
}
export default analyzeGPS;
// Generation time: 53.787s
// Result: PASS