fallback_speed parameter doesn't working if coordinates are outside map boundaries
Let's assume we have small map file. And trying to build distance matrix from points with no map data. Pickup - P Dropoff - D
P1 -> D1 - we have values in distance matrix
P2 -> D2 - distance matrix gives values = 0
Adding fallback_speed parameter to request doesn't work
fallback_speed is used to estimate the duration from the direct-line distance when no route can be found.
If it's returning a distance of 0, the drop-off point is being snapped to the same location as the pickup point, which can happen for a variety reasons.
Are you able to provide reproduction steps (OSRM pre-processing, queries) for the behaviour you are seeing?
Steps to reporoduce:
- Download any pbf file (example Monaco city)
- run extraction:
osrm-extract -p /opt/car.lua "/data/$FILE_NAME.osm.pbf" - contact
osrm-contract "/data/$FILE_NAME.osrm" - run routed
osrm-routed --algorithm ch "/data/$FILE_NAME.osrm" - request matrix calculation with locations that non in Monaco city (example France)
It's quite trivial to create a query that doesn't have this behaviour (zero distance). For example setting the coordinates to be from Nice and Menton, on opposite sides of Monaco.
curl "http://localhost:5000/table/v1/car/7.2683912,43.7009358;7.50198,43.77535?annotations=distance" | jq ".distances"
[
[
0,
4454
],
[
4733.6,
0
]
]
What you are seeing most likely is two locations outside of the graph snapping to the same position on the road network, thereby giving you a distance (and duration) of zero between the two. If you have a specific query where you are seeing this, we can confirm the snapping behaviour.
In general, I'm not sure we want OSRM to optimise for behaviour where we know the locations are outside of OSM snippet boundary. At query time, OSRM isn't aware of the OSM bounds.
What is the ideal behaviour you want to see here? If it's outside of the OSM bounds, reject the query? A straight-line distance? Something else?
What you are seeing most likely is two locations outside of the graph snapping to the same position on the road network
FWIW you can easily confirm this by using the frontend where snapping is materialized by gray dotted lines.
Just for comparison, Openrouteservice does raise an error when requests contain coordinates outside the OSM extract (I have no idea how complex it would be to do the same for OSRM).