-
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
allow node_function() to add penalty to a segment #3862
Comments
duplicate of #96? |
well, 96 is two weeks younger than 77 :) i'll try some osmosis preproccessing and see if it's any good. |
maybe a stupid question, how do I add a penalty in the node_function()? something like
does not seem to work. |
You can't in the node function. The node callback handles nodes only. Specifically this means all it can set are the A good resource on profiles is #3842 |
should I write a feature request on allowing for arbitrary weight/duration change in the node_function() ? |
The concept of a weight / duration does not make sense for nodes, only for ways / segments. If you check the first two schemas in the following image: in the first one we have OSM ways. The second one has durations for segments. What you can do is e.g. provide a |
I am thinking of these scenarios for foot profile: crossing a major road where the crossing a but as you've said, turn penalties are a different issue (like penalize left turn from a multi lane road by bicycle) |
another examples are |
@MichalPP The way this would need to be modelled is to use these nodes types as nodes in the edge-based graph. Basically, passing a We currently special-case this for traffic lights, but the mechanism can probably be improved and made more generic. For simple cases, like a barrier along a single way, this should work fine. For more complex cases, like barrier nodes where multiple ways meet, it's more complicated - which of the maneuvers should get the penalty? All of them? Some of them? 4-way traffic lights/stop signs are an example of this already. |
@danpat I was thinking of just adding extra duration/weight to a segment if it has a special node. I didn't want to split edges (but I have no idea of the internal structures of OSRM) |
Unfortunately, because of how we need to support updates for traffic data, any node that adds a penalty will cause a split. We really only support traffic lights right now, but they cause splits here: If we don't split, then we won't know to add a penalty during the generation of the turn graph (the last graph shape in the image a couple of comments back). We could add the penalty to the edge immediately before or after the node, but again, this would get lost during updates with traffic data (not always applicable, but we can't just break this feature). In order for it to stick around, it has to form part of the turn graph (aka the edge-based-graph), which means there needs to be a turning maneuver generated there, even if it's a no-op. |
@danpat after looking at the traffic, maybe it should define not new speed but rather some multiplication constant the alter the old speed (which would keep things like elevation profile speeds; I wanted to make some adjustments to foot/ski profile, but calculating the speeds is really expensive). still not sure why traffic_calming should split an edge. or, is it possible to have a list of osm_ids of nodes in each edge? with special nodes first and last. |
@MichalPP OSRM models the road network as a "turn graph" (a.k.a the "edge-based graph"). Every "edge" that's routable inside OSRM consists of:
The fourth graph in the diagram above shows a rough approximation of the edge-based-graph. In order to include penalties for nodes in this model, the only way to add weight to an edge is to simulate it with a "turn" - turns don't always emit an instruction, but they are the way we need to add penalties in this model. This is why edges need to be split. We're kind of dancing around the issue - can you describe the exact problem you're trying to solve? You've mentioned ski/foot profiles - can you describe your problem in more detail? |
let's have an example of In the To have good penalty for traffic calming, I would need to know speed on the segment and then calculate time needed for the slowdown (eg for a hump, the penalty would be zero if speed is 10km/h, but 20s if speed is 30km/h). overall, my whole point is valid only under assumptions
if they are not valid, consider my argument invalid... |
This issue seems to be stale. It will be closed in 30 days if no further activity occurs. |
(probably a documentation issue), is it possible to penalize crossing based on the type of way we cross?
eg. in foot profile, I want to avoid crossing highway=primary but allow to cross easily highway=residential.
I know that we do not need to cross one OSM way, so the highway tag on the left and right can be different.
The text was updated successfully, but these errors were encountered: