Creating Street Lights with Traffic Signals from OSM data

  • I was experimenting with street lights from ScenProc and ran across the traffic_signals reference in the OSM data. With the addition of 2 lines to my ScenProc lights script, I was able to randomly generate red & green lights at the traffic signal coordinates (look for the red/green intersections in the pic below).

    Here are the 2 lines to add to your cultivation script:

    # Traffic signals

    CreateAF2Light|highway="traffic_signals" And FRAND<=0.5 |1.0;0.0;0.0|2|0;0;1|5

    CreateAF2Light|highway="traffic_signals" And FRAND>0.5 |0.0;1.0;0.0|2|0;0;1|5

    The FRAND part is set to randomly generate a red or green light for each set of traffic signal coordinates (50/50 odds).

    The next part |1.0;0.0;0.0| controls the color and brightness/intensity of the light - the 3 numbers are in Red/Green/Blue (RGB) format. In the first example, Red is set to 1.0 or 100% brightness and the Green & Blue values are zero or off. If you want Red at 50% brightness, set Red to 0.5 - if you want a white light at 50% brightness, set all 3 to 0.5 or |0.5;0.5;0.5| . To get the orange-like color in the pic above, set Green to half the value of Red and leave Blue at zero.

    The next part |2| is the size of the light. In the pic above, I used 100 for interstate/tollway/freeway lights and then worked down to 10 for residential lights and 2 for traffic signals. NOTE - If you fly VR exclusively, cut all these numbers in half in order to get a sharper image with your VR headset. Think of this number like the size of a balloon.

    The next part |0;0;1| controls the flashing behavior of the light - using 0;0;1 sets the light to always on.

    The last part |5 is the height of the light above the road in meters. I used 20 meters for interstate/tollway/freeway lights and then worked down to 5 meters for residential lights and traffic signals.

    I've attached my lights template below if you want to add pieces of it to your cultivation script. If you want to change the spacing of the lights, adjust the numbers after the |SINGLE| reference below. In these 2 examples, they are generating points spaced 200-250 meters apart and 300-350 meters apart. The next set of numbers |6;6| determine whether the light points run down the center of the road or are placed a distance away from the center - 6;6 means the points are placed 6 meters away from the center of the road (6;10 would place the point 6-10 meters from the center). 0;0 means in the center.

    # Interstates, tollways, freeways



    # Major city roads



    Here's the lights template that will generate a separate lights toc file to add to your airport's tsc file cultivation section.


  • You're welcome Thomas/Jake!

    It was easier to tweak all the light types with a separate toc file - started with the major freeways and worked through each type down to residential (tweak/rerun ScenProc, replace toc file, restart FS2 to evaluate changes, then repeat process). The ScenProc runs only took 20-30 seconds for a level-9 size OSM section since I was only generating lights. Probably went through ~50 tweak loops to get to the lights template above.

  • Nice touch Ken. I will add this to Chris' ver 5 that I am currently using. If you come across some code to find more residential houses please let me know. Some areas like South and West Florida are loaded with all the goodies, but Central, East and North are very sparse on the residential houses, although the commercial buildings seem to be present as expected. Lots of trees, woods, wetlands, etc. in all areas.



    A steely-eyed Sierra Hotel record setting F-15E Strike Eagle simulator pilot. 8o
    Out now: Hawaiian Islands 8) Part 1: Kauai + Niihau v2

    Work in Progress: Part 2: Molokai, Maui, Lanai, Kohoolawe + Molokini Crater