Open danielbeeke opened 2 months ago
You could use https://github.com/dabreegster/route_snapper/blob/bdb5e99e2b3db51518a9122fc17ea56b009cdb71/route-snapper-ts/src/index.ts#L219 in the TS library, then read out routeToolGj
there. This is from the newer TS library that's on NPM, but sadly undocumented.
Or to avoid the maplibre dependencies entirely, just go through the WASM API, adding two snapped waypoints.
If your goal is to just calculate routes from OSM data in JS, using this project might be a heavyweight option, but it does work.
Should I import the WASM directly for this use case? or is there some method that would do this already?