bcgov / ols-router

BC Advanced Route Planner
https://bcgov.github.io/ols-router/
Apache License 2.0
24 stars 11 forks source link

Snap tolerance parameter #356

Open BK01 opened 1 year ago

BK01 commented 1 year ago

Current state: The BC Route Planner will compute a route along the road network to (or parallel to) coordinates within 1km of the road centre-line [MAX_SNAP_DISTANCE = 1000].

Test case: Destination is approx 1.2km from the road. https://router.api.gov.bc.ca/directions.json?points=-123.14517%2C49.70719%2C-123.12172%2C49.68690&snapDistance=1200

Future state:

cmhodgson commented 1 year ago

We never discussed the name of the parameter, but I went with the initial suggestion "snapDistance" - this is a request parameter than can be set for each request. I also setup an application-level configuration parameter called defaultSnapDistance which can be changed using the config UI or editing the configuration files, this sets the default value of the snapDistance parameter if no value is specified in the request.

cmhodgson commented 1 year ago

Note that the existing "demo" support for 511 events now uses the defaultSnapDistance config parameter as a limit for how far events can be from segments and still be attached to them. The existing demo 511 event file contains only very close matches so this tolerance isn't really used at this time.

BK01 commented 9 months ago

Validated in BC Route Planner 2.2 (router-dev.api.gov.bc.ca) on Dec 19, 2023. Test case above used with a distance of 1000m (no route found) and 1200m (route found)