You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While I was driving through town today, rejecting the routing suggestions of my professional car navigation, I had this idea: The navigation was suggesting a road that looked faster according to distance and street class. But I know that there are a series of traffic lights on that road and it is actually faster to drive around it on a road without lights.
Common navigation systems are usually pretty bad about this, they are too optimistic when you drive downtown. I heard from a navigation guy a while ago that the commercial navigation data does not contain traffic lights.
So basically we should evaluate the (500000) traffic lights in the OSM data and if an edge has a traffic ligth, add a small speed penalty to that edge for car and bike traffic.
Regarding the pedestrian: yeah, crossing the roads should in general decrease the safety BUT only for certain road types. That is rather complicated :) I'll have to think about this.
One more thought: one further improvement (before this?) could be to take administrative borders into account so that the speed limit - at least for car - can be better calculated.
This has been discussed at OSM many times, for assigning streets to cities or for speed limit. Finding out whether any road is inside one of a large number of polygons is very expensive. OSM stuck to tagging redundant is_in relations and maxspeed on every way.
Not if we use clever stuff. E.g. for one polygon we can find one containing point and from that just traverse the roads (until we go outside of it) and so all the other edges can be found very fast. With this approach it is only O(n). Also we can reduce the polygon complexity if that is a big problem
Make sure that the administrative data is reliable enough.
Yeah, that is probably the biggest problem. But also the country differences. Is there a concept of speed limits in villages and cities in every country and in OSM data?
I have two questions on implementing the traffic lights interpretation:
First I'm not sure where to put it. Maybe a new method in the AbstractFlagEncoder just as handleFerry?
Second these traffic_signals are nodes and I'm not sure how to get all trafficsignals of a OSMway. I tried way.getNode() but this doesn't seem to deliver me the node with tags to analyze them.
You can use the analyzeNodeTags method where you should be able to return an encoded value of a speed change or time penalty which is then used to change the speed or something like this
After reading lots of lines of code and the corresponding comments, I thought that returning a negative speed value at analyzeNodeTags would do the trick. But neither this nor modifications at other parts of the code changed something.
I think my problem is that I didn't understand the nodeBits. Maybe you can give a short explanation for this?
Hmmh, strange. The method 'analyzeNodeTags' will create the node-long value which is then taken into account when 'applyNodeFlags' is called which returns the way flags where you could e.g. decrease the speed.
See how this should work in OSMReaderTest.testEstimatedCenter
I now managed to prolong the time on routes with trafficlights by reducing the speed in don-philipe/graphhopper@827223a. But I get strange routing decisions now. Obviously longer (with respect to time an distance) routes will be taken. It seems that the routes, that had been taken before the introduction of the speedpenalty, are now only "streched".
I implemented a branch to take traffic lights into account. Although this leads to quite realistic travel times, the routing now becomes sometimes a bit arkward, trying to circumvent traffic lights by going around in zick-zack. It seems, that one can only take traffic lights into account, if general turncosts are taken into account.
@jansoe I need further information (where on the route are traffic lights, roundabouts, crosswalks, …) for the application in my diploma thesis. As far as I see, your information is added during the prepare step, right? Do you know of a way to preserve that information for later processing? Is there a possibility to extract all this info from a final route?
If you need help with the turncost implementation (which would also be interesting for me), drop me a line.
Activity
karussell commentedon Jun 10, 2013
That should be relative simple to implement for the car. Then we can avoid routes like
Regarding the pedestrian: yeah, crossing the roads should in general decrease the safety BUT only for certain road types. That is rather complicated :) I'll have to think about this.
karussell commentedon Jun 11, 2013
One more thought: one further improvement (before this?) could be to take administrative borders into account so that the speed limit - at least for car - can be better calculated.
NopMap commentedon Jun 12, 2013
This has been discussed at OSM many times, for assigning streets to cities or for speed limit. Finding out whether any road is inside one of a large number of polygons is very expensive. OSM stuck to tagging redundant is_in relations and maxspeed on every way.
karussell commentedon Jun 12, 2013
why? we could do this in Java
NopMap commentedon Jun 12, 2013
Sure. But it is a n to n match with a performance of x^2.
.
karussell commentedon Jun 12, 2013
Not if we use clever stuff. E.g. for one polygon we can find one containing point and from that just traverse the roads (until we go outside of it) and so all the other edges can be found very fast. With this approach it is only O(n). Also we can reduce the polygon complexity if that is a big problem
NopMap commentedon Jun 12, 2013
I remain sceptical. Make sure that the administrative data is reliable enough. As OSM uses a different concept, it might have major gaps.
karussell commentedon Jun 12, 2013
Yeah, that is probably the biggest problem. But also the country differences. Is there a concept of speed limits in villages and cities in every country and in OSM data?
don-philipe commentedon Mar 14, 2014
I have two questions on implementing the traffic lights interpretation:
First I'm not sure where to put it. Maybe a new method in the AbstractFlagEncoder just as handleFerry?
Second these traffic_signals are nodes and I'm not sure how to get all trafficsignals of a OSMway. I tried way.getNode() but this doesn't seem to deliver me the node with tags to analyze them.
karussell commentedon Mar 14, 2014
You can use the analyzeNodeTags method where you should be able to return an encoded value of a speed change or time penalty which is then used to change the speed or something like this
don-philipe commentedon Mar 18, 2014
After reading lots of lines of code and the corresponding comments, I thought that returning a negative speed value at analyzeNodeTags would do the trick. But neither this nor modifications at other parts of the code changed something.
I think my problem is that I didn't understand the nodeBits. Maybe you can give a short explanation for this?
karussell commentedon Mar 18, 2014
Hmmh, strange. The method 'analyzeNodeTags' will create the node-long value which is then taken into account when 'applyNodeFlags' is called which returns the way flags where you could e.g. decrease the speed.
See how this should work in OSMReaderTest.testEstimatedCenter
don-philipe commentedon Mar 18, 2014
I now managed to prolong the time on routes with trafficlights by reducing the speed in don-philipe/graphhopper@827223a. But I get strange routing decisions now. Obviously longer (with respect to time an distance) routes will be taken. It seems that the routes, that had been taken before the introduction of the speedpenalty, are now only "streched".
jansoe commentedon Apr 20, 2015
I implemented a branch to take traffic lights into account. Although this leads to quite realistic travel times, the routing now becomes sometimes a bit arkward, trying to circumvent traffic lights by going around in zick-zack. It seems, that one can only take traffic lights into account, if general turncosts are taken into account.
andreaswolf commentedon Apr 21, 2015
@jansoe I need further information (where on the route are traffic lights, roundabouts, crosswalks, …) for the application in my diploma thesis. As far as I see, your information is added during the prepare step, right? Do you know of a way to preserve that information for later processing? Is there a possibility to extract all this info from a final route?
If you need help with the turncost implementation (which would also be interesting for me), drop me a line.
karussell commentedon Jul 27, 2021
We should focus on #230 instead of this to avoid the problems @jansoe pointed out.
Handle path details state within app (graphhopper#75)