Skip to content

Interpret traffic lights #75

Closed
Closed

Description

@NopMap

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.

Also, I found that there is a tag for pedestrian crossings
http://wiki.openstreetmap.org/wiki/DE%3ATag%3Ahighway%3Dtraffic_signals

Evaluating this could make a route much safer, but it's rather complicated, I don't have a simple idea on how to do it.

  • clean up import and make node tags influence possible
  • tune speed decrease but keep in mind that traffic lights could be off at night so use a low influence as start.

Activity

  1. karussell commented on Jun 10, 2013

    @karussell
    Member

    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.

  2. karussell commented on Jun 11, 2013

    @karussell
    Member

    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.

  3. NopMap commented on Jun 12, 2013

    @NopMap
    ContributorAuthor

    take administrative borders into account

    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.

  4. karussell commented on Jun 12, 2013

    @karussell
    Member

    Finding out whether any road is inside one of a large number of polygons is very expensive.

    why? we could do this in Java

  5. NopMap commented on Jun 12, 2013

    @NopMap
    ContributorAuthor

    Sure. But it is a n to n match with a performance of x^2.
    .

  6. karussell commented on Jun 12, 2013

    @karussell
    Member

    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

  7. NopMap commented on Jun 12, 2013

    @NopMap
    ContributorAuthor

    I remain sceptical. Make sure that the administrative data is reliable enough. As OSM uses a different concept, it might have major gaps.

  8. karussell commented on Jun 12, 2013

    @karussell
    Member

    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?

  9. don-philipe commented on Mar 14, 2014

    @don-philipe
    Contributor

    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.

  10. karussell commented on Mar 14, 2014

    @karussell
    Member

    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

  11. don-philipe commented on Mar 18, 2014

    @don-philipe
    Contributor

    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?

  12. karussell commented on Mar 18, 2014

    @karussell
    Member

    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

  13. don-philipe commented on Mar 18, 2014

    @don-philipe
    Contributor

    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".

  14. jansoe commented on Apr 20, 2015

    @jansoe
    Contributor

    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.

  15. andreaswolf commented on Apr 21, 2015

    @andreaswolf
    Contributor

    @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.

  16. karussell commented on Jul 27, 2021

    @karussell
    Member

    We should focus on #230 instead of this to avoid the problems @jansoe pointed out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions