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