Automatically move the map onto the feature, add arguments to helpers

This commit is contained in:
Pieter Vander Vennet 2021-07-20 01:59:19 +02:00
parent 4fa9159da1
commit aa9045fd13
5 changed files with 58 additions and 22 deletions

View file

@ -273,6 +273,14 @@ export class GeoOperations {
}
return undefined;
}
/**
* Generates the closest point on a way from a given point
* @param way The road on which you want to find a point
* @param point Point defined as [lon, lat]
*/
public static nearestPoint(way, point: [number, number]){
return turf.nearestPointOnLine(way, point, {units: "kilometers"});
}
}