Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use estimates for NoRoute in table requests #5257

Merged
merged 2 commits into from
Nov 2, 2018

Conversation

danpat
Copy link
Member

@danpat danpat commented Nov 2, 2018

Issue

When working with very large table requests (1M+ entries), it can be difficult to parse/modify/handle the large response.

A common request we've had from customers is to "never return a null value in a table response" - usually, if no route is found, some estimate can be used instead.

This PR implements a new Table API parameter called fallback_speed. When used, if a null field exists in a table JSON response, it will be replaced by a straight-line estimate between the source/destination. By default, we measure the distance between the input coordinates (supplied in the request), but you can use fallback_coordinate=snapped to use the snapped location instead. Once the distance is found, it is divided by the fallback_speed value to come up with a duration estimate.

Doing this work inside OSRM before constructing the response JSON is significantly more convenient and performant than doing it after the fact dealing with JSON data.

For 1,000,000 cell table requests (which takes about 2-3s on my test machine), this adds approximately 0.7ms if there are no null values to be replaced, and about 30ms if all cells need to be replaced.

Tasklist

@danpat danpat force-pushed the danpat_table_noroute_estimate branch from 37b2713 to 6667600 Compare November 2, 2018 08:07
@danpat danpat force-pushed the danpat_table_noroute_estimate branch from 6667600 to 364e35a Compare November 2, 2018 08:09
@danpat danpat merged commit 9738372 into master Nov 2, 2018
@DennisOSRM DennisOSRM deleted the danpat_table_noroute_estimate branch November 6, 2022 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant