-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Excluding specific roads at query-time #4006
Comments
cool. a use case relevant for us is routing for cargo bikes, where you need to avoid steps (you can push a bike on steps if needed, but not with a cargo bike), certain cycle-barriers, etc. instead of running a separate profile for cargo bikes, we could use the normal one and just avoid these when the user requests a route for cargo bike. however, these barriers are tagged on nodes. so it would require avoid flags on nodes as well as ways. |
another use case is opening_hours for parks/places/barriers or unlit footways at night. |
@TheMarex I'd suggest that the Lua profile property name is I think that property names should generally be adjectives or nouns, |
Another implementation note: if That said, access to road class flags in the debug tiles could be nice to have, even if avoidance overlays aren't available..... |
profile.avoid is already used for things that should always be avoided. |
Some more notes on this feature after a discussion with @oxidase and @karenzshea:
|
Thinking about this a little more we can also use this to expose any user-defined class on a per-edge basis:
|
Current brain dump on how this will work and where I see problems:
|
could this be extended for a more granular usage? say i want to avoid the center of avignon in all my queries during juli without having to regenerate my graph? |
@jellevictoor You can achieve this by preprocess the data and add a tag to all ways in centre of Avignon, then use this tag as class. But whit this feature you can't do this in a generic way. As the maximum number of class if 8 and must be done before building the data. |
+1 for this issue. I am actually looking for routing around a fixed obstacle polygon similar to #892, but I am fine if the polygon can be specified at the preprocessing stage too. This is specially useful in cities with environmental avoidance zones. This issue is a good way for resolving the polygon avoidance problem. |
@mohsen3 This issue is about avoiding certain classes of roads (e.g. highways, etc) that you can identify during pre-processing. It does not enable totally dynamic selection of edges at query time. There is a different pull request #4167 that is about enabling polygon lookups during pre-processing, which would allow you to penalize ways within certain regions, but that change is not yet merged. |
I've been thinking about how to implement this for CH and this is what I've got so far: Option 1: Completely separate CHsBy filtering the graph for each avoid combination we can create multiple graphs and contract each one independently. This will require a lot more memory/disk and pre-processing time. Since these graphs don't differ too much (only few nodes are actually avoidable) most of this will just be duplicated data/computation. Option 2: Only separate CHs for the avoidable nodesThe main idea here is to have one CH for all non-avoidable nodes and for each avoid-combination only a CH of the usable nodes.
Now the interesting challenge here is how we piece together a whole CH from these pieces during query time. We have some constraints, for example introducing new node IDs will leads to a lot of problems with unpacking and indexing of other data structures. Storing avoid-CHs as completely different graphs means we need to keep track of when we switch graphs and makes the whole query algorithm quite complicated. |
|
This issue is a planning ticket for upcoming features in the 5.9 series.
Exclude Overlays
Goal
Enable users to exclude certain classes of roads at query time. The typical use case for this is excluding highways or ferries.
API changes
Lua profile
Instead of hard-coding specific classes we want to keep this more general. This requires us to have an interface in the profiles to:
true
/false
if they fall into that exclude category. Expose user-defined class information #4203This is a sketch of what the interface could look like:
HTTP/node
We need a new query parameter to select which avoid layer (if any) to use.
exclude
Array of String Name of the classes to exclude. (Default:none
)Example:
http://router.project-osrm.org/-100.063476,37.230328;-100.898437,35.817813?exclude=highway,ferry
Implementation changes
While parsing the OSM ways we need to keep track of all referenced exclude classes and save all ways that are marked with
true
.Flags need to be propagated up
EdgeBadedGraphFactory
and should be indexed byEdgeBasedNode
(e.g. a node in the turn based search graph)The algorithm dependent tools need to be extended:
osrm-customize
will run the customization for every exclude layer (and with no exclude flags at all).osrm-contract
will create an own (filtered) graph for every exclude layer and contract itWe need to modify the engine to accommodate multiple overlays:
exclude
is passed theRTree
should not snap on nodes with a matching exclude flagCellStorage
needs to be able to store multiple weight vectors (one for each exclude overlay)string
to ID of the exclude layer in theCellStorage
EDIT: The flag got renamed from
avoid
toexclude
to make the behavior more explicit and avoid (hah) confusion.The text was updated successfully, but these errors were encountered: