Files
lynchmark/tests/11_geospatial/outputs/moonshotai_kimi-k3 EFF_medium.js
2026-07-16 18:31:31 +00:00

13 lines
607 B
JavaScript

async function analyzeGPS(readings, boundary) {
if (!Array.isArray(readings) || readings.length < 2) return 0;
const m = await import('https://cdn.jsdelivr.net/npm/@turf/turf@7/+esm');
const { booleanPointInPolygon: inside, lineString, length } = m.default ?? m;
const coords = readings
.filter(({ loc }) => loc && inside(loc, boundary, { ignoreBoundary: true }))
.sort((a, b) => a.ts - b.ts)
.map(({ loc }) => loc);
return coords.length < 2 ? 0 : +length(lineString(coords), { units: 'kilometers' }).toFixed(2);
}
export default analyzeGPS;
// Generation time: 75.533s
// Result: PASS