mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-03-17 11:21:00 +00:00
10 lines
441 B
JavaScript
10 lines
441 B
JavaScript
async function analyzeGPS(readings, boundary) {
|
|
const turf = await import('https://esm.sh/@turf/turf');
|
|
const valid = readings.filter(r =>
|
|
turf.booleanPointInPolygon(turf.point(r.loc), boundary, {ignoreBoundary: true})
|
|
).sort((a, b) => a.ts - b.ts);
|
|
return valid.length < 2 ? 0 : Math.round(turf.length(turf.lineString(valid.map(v => v.loc))) * 100) / 100;
|
|
}
|
|
export default analyzeGPS;
|
|
// Generation time: 97.874s
|
|
// Result: PASS
|