bcgov / ols-router

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

Error handling for optimalRoute - Route not found #376

Open BK01 opened 6 months ago

BK01 commented 6 months ago

Issue description: Within the BC Route Planner test environment (v 2.2.1), the following example generate a 500 error when a route is not found based on the snapDistance parameter value when using /optimalRoute. This behaviour also occurs in production for /optimalRoute, but not for /route.

To reproduce: Append an API key to the following URL and run the tests.

Expected behavior: Response - HTTP 200 "routeFound": false, "distance": -1, "time": -1, "timeText": "-1 seconds",

Test URL:

A route will only be found when snapDistance=2100 or higher

https://routertst.api.gov.bc.ca/optimalRoute.json?points=-123.16002%2C49.67238%2C-123.13090%2C49.67107&outputSRS=4326&criteria=fastest&distanceUnit=km&roundTrip=false&routeDescription=/optimalRoute%2520-%2520snapDistance%3D1000%2520%28json%29&enable=gdf%2Ctr%2Cxc%2Ctc&disable=td%2Cev%2Csc%2Ctf%2Ctl&gdf=&xc=3.0%2C10.0%2C7.0%2C1.2&tc=3.0%2C1.0%2C10.0%2C5.0&departure=&correctSide=false&simplifyDirections=false&simplifyThreshold=250&snapDistance=1000