bcgov / ols-router

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

Unexpected Route #210

Closed gk-tl closed 3 years ago

gk-tl commented 4 years ago

East-West route through New Westminster is not consistent with expectations. While the generated route is "valid" from a bylaw compliance perspective (depending on the time of day), a route via Front Street wold be more consistent with industry and municipal preferences.

Route via Front Street avoids steep grades on McBride Blvd and Royal Ave (which is also a limited use truck route with a time restriction)

image

@al-tabb - please weigh in.

gk-tl commented 4 years ago

Truck access to Port Terminals - South Shore

Cannot generate route to vehicle access gate for trucks at Centerm/Vanterm. Expected route should be via Clark Drive when travelling north/south on Clark/Knight Street or via Commissioner Drive/Stewart Street when travelling to/from Hwy 1. Issue likely stems from the fact that Commissioner Drive/Stewart Street is classified as a Port Access Road. Potential fix would be to change the designation to a municipal road (i.e., non-truck route), while leaving the cartographic layer as is. This would generate a dotted red line on Commissioner Drive/Stewart Street. Furthermore, user cannot currently set the origin/destination to either terminal (i.e., Centerm or Vanterm) by clicking on the map or by address search.

image

image

@al-tabb please weigh in.

NicoledeGreef commented 4 years ago

After discussing with @mraross we decided we should transfer this issue to the ols-router repo. Meeting to be held soon re: Benchmark Routes.

mraross commented 4 years ago

Nicole and I also agreed that by changing the beta app behaviour when you click on the map to simply picking up the coordinate location under the cursor and adding it as a waypoint to the route would allow you to define a route from and to anywhere on the road network including port terminals, highway shoulders, etc.

Currently in the beta app, when you click on the map, the app looks for the nearest civic address to the point, which, in many cases, can be quite far from cursor location.

mraross commented 4 years ago

As for the route planner not following Front St instead of Royal and McBride, what data is available to your old beta that allowed it to follow Front St?

gk-tl commented 4 years ago

TL BETA also generated the unexpected route via Royal Ave. However, the cost for a designated truck route with restrictions (i.e., Royal Ave) should be slightly higher than for a designated truck route without restrictions (i.e., Front Street). That should generate the anticipated route.

@al-tabb

al-tabb commented 4 years ago

I don’t believe there is currently an exception for Front St in the database. However there could be a number of exceptions added that would either decrease the cost of Front St segments relative to Royal and McBride or increase the cost of Royal and McBride segments relative to Front St.

All of the exceptions are captured in the table ‘exceptions’ in the PostGIS database. There is a python script that I believe I passed on earlier that calculates the ‘default cost’ of all segments based on their truck route status and road type. The ‘final costs’ of any exception segments are calculated from the information captured in the ‘exceptions’ table. Many of them simply reverse the cost (multiply by -1) but some do a relative calculation to favour them over other segments. The Front St example would fall into the latter category.

gk-tl commented 4 years ago

All of the exceptions are captured in the table ‘exceptions’ in the PostGIS database. There is a python script that I believe I passed on earlier that calculates the ‘default cost’ of all segments based on their truck route status and road type. The ‘final costs’ of any exception segments are calculated from the information captured in the ‘exceptions’ table.

During a follow-up conversation re. this ticket, @al-tabb aptly pointed out exceptions are needed given there will always be edge cases where we need to calculate costs differently from our general classification scheme (i.e. opening up a small number of private, restricted, etc. roads for truck travel).

An exceptions table would address the Royal Ave vs Front Street route and any other "fine tuning" needed to generate routes consistent with user expectations that don't fit the general classification scheme.

Happy to discuss further.

gk-tl commented 4 years ago

A somewhat stylized example of an existing "exception" in the TL BETA:

Maple Ridge - Lougheed Highway between Kanaka Way and 222 Street is an exception in the TL BETA. The cost is set higher relative to Haney Bypass so that the Bypass is more likely to be selected as the potential route,, particularly when the truck is not making any deliveries in Maple Ridge.

Similar to the case of Royal Ave vs Front Street, while Lougheed and the Bypass are valid routes from a "compliance" perspective, funneling trucks to the Bypass is more consistent with prevailing land-use along the segment of Lougheed Hwy between Kanaka Way and 222 Street, which is effectively the town centre for Maple Ridge (and hence a less appealing option for trucks than the Bypass).

image

image

@al-tabb

qqnluaq commented 4 years ago

Found another weird route: image

Going south on Blanshard past Belleville isn't allowed for any vehicle.

curl 'https://ssl.refractions.net/ols/router/truck/directions.json?criteria=shortest&distanceUnits=km&followTruckRoute=true&truckRouteMultiplier=10&outputSRS=4326&partition=isFerry%2CisTruckRoute&points=-123.364594%2C48.4245664%2C-123.8590317%2C48.3795334' -H 'Connection: keep-alive' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Origin: https://ben.vividsolutions.com:8443' -H 'apikey: 11dd756f680c47b5aef5093d95543738' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36' -H 'Sec-Fetch-Site: cross-site' -H 'Sec-Fetch-Mode: cors' -H 'Referer: https://ben.vividsolutions.com:8443/example/translink/?show-tool=version' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: en-US,en;q=0.9' --compressed

mraross commented 4 years ago

The route planner in the demo app is not routing south on Blanshard below Belleville. The route goes around the long way and turns south from Belleville onto Blanshard which is legal. See https://office.refractions.net/~chodgson/gc/ols-demo/?rt=rri

image

cmhodgson commented 4 years ago

Ben can you send me the URL you are hitting to get that result? I wonder if turn restrictions are disabled?

cmhodgson commented 4 years ago

I have some untested code in place to support moving to an "enable"-based routing option control from the current "disable" based approach - this is causing the default enabled options to be inverted, which means that Turn restrictions are defaulted to off. I have the fix in my local code, I'm in the middle of some other changes so I'm not going to deploy this fix immediately, but it will be in place by the end of the week at latest. This fixes Ben's most recent Blanshard/Belleville case, but not the other earlier cases.

gk-tl commented 4 years ago

Hello everyone. I'm wondering whether it is necessary to test the router in Victoria (at this point) given that we only have municipal truck route data for the Lower Mainland. Some of the issues above could be the result of incomplete truck route info for Victoria.

cmhodgson commented 4 years ago

Local knowledge plays an important part in validating route results, and we may not all have good local knowledge of the Lower mainland truck routes. While the Victoria-area example may not be a good direct test of the truck routing in the lower mainland, it did find an important global bug which would also manifest all over BC. The fix for it, however trivial, is accounted for under the router maintenance contract, not on Translink's dime.

mraross commented 4 years ago

To add to Chris's comment, the router must route right across BC since that is still in scope for the TransLink app.

gk-tl commented 4 years ago

Thank you for clarifying.

mraross commented 4 years ago

East-west route through New Westminster looking better; now taking Front St. thanks to local distortion field there.

image

gk-tl commented 4 years ago

Looks good. Thanks Michael.

mraross commented 4 years ago

Verified in delivery