Highlighting everywhere I can go without hitting a traffic light?

Hi all,

Let’s say I live on an island with several neighborhoods. Most intersections do not have traffic lights, but there are traffic lights at some of the intersections, and at many chokepoints between neighborhoods.

Because of this, it is often not possible to avoid traffic lights when travelling from neighborhood to neighborhood. However, many intra-neighborhood trips are still possible.

I have GPS coordinates of all the traffic lights.

How complex would it be to create each of the following web apps?

1: A user could input the position of their car and in return see a map with highlighting on all the roads they can access without going through a trafficlight-controlled intersection.

  1. A user could ask for navigation, and the app would tell them if it was possible to arrive at the destination without crossing an intersection controlled by a trafficlight.

Is there a way to do this with basic OSM skills? If I had GPS coordinates of all the traffic lights, and te routing algorithm was set to avoid those points by say, 100’, how hard would it be to highlight all the roads that a car could access, given its location… ?

Thanks so much!! I have been thinking about this a lot but don’t know where to start.

I would say first add those traffic lights to OpenStreetMap provided off-coarse that you have permission to import the GPX data. The good thing is that this will also benefit others.

Once everything is has been checked in, wait 2 days (so the data is synchronized) and go to BRouter web client and then:

  1. Chose the profile you want to start with (top left)
  2. Click the wrench button (top left) to open “customize profile”
  3. Click the profile tab and you should see the ---context:node part at the bottom
  4. Add there code to make the “initialcost” for a node with highway=traffic_signals the value 1000000

For example for the Car (fast) profile, the third (added) line below.

assign initialcost =
       switch and avoid_toll barrier=toll_booth 1000000
       switch highway=traffic_signals 1000000
       switch caraccess

1000000 means the route will never cross the node, but I think you beter set it to another high number like 1000 so that the router will still chose for the route with the traffic signal if the best alternative route is about 1000 meter longer.

1 Like