Choosing signal placing based on traffic flows

Contents

Choosing signal placing based on traffic flows#

In this example we show how to use Polaris-Studio to determine which intersections would require traffic control signals based on the first three criteria from the US FHWA’s “Manual on Uniform Traffic Control Devices for Streets and Highways”.

This resource is particularly relevant for future scenarios, as base-year traffic signal location can be obtained from Open Street Maps.

For reference, see chapter 4C of the MUTCD, which provides the criteria for signal placement: https://mutcd.fhwa.dot.gov/pdfs/11th_Edition/mutcd11thedition.pdf

Imports#

from polaris import Polaris
from polaris.utils.testing.temp_model import TempModel
⚠️ Friendly exception handler is disabled via FRIENDLY_ERRORS_DISABLED

Open the Network and build the signals based on traffic flows

model_fldr = TempModel("Grid")

pol = Polaris.from_dir(model_fldr)
network = pol.network
2026-06-07 10:08:19 UTC+0000 - Working with file on /tmp/polaris_studio_testing/2026-06-07_10-08-18--d867e076c217/Grid-Supply.sqlite
nodes = network.tables.get("Node")
links = network.tables.get("Link")
prev_signals = network.tables.get("Signal").nodes

m = links.explore(tiles=None)
nodes[nodes.node.isin(prev_signals)].explore(m=m, color="black", style_kwds={"radius": 5, "fillOpacity": 1.0},
                                             name="nodes")
Make this Notebook Trusted to load map: File -> Trust Notebook


Now we rebuild the intersections with signals placed according to traffic flows and see the result

network.tools.rebuild_intersections(signals="flow-based", h5_results_file=pol.result_h5_file)

new_signals = network.tables.get("Signal").nodes

m = links.explore(tiles=None)
nodes[nodes.node.isin(new_signals)].explore(m=m, color="black", style_kwds={"radius": 5, "fillOpacity": 1.0},
                                            name="nodes")
2026-06-07 10:08:20 UTC+0000 - Starting connection rebuild
2026-06-07 10:08:20 UTC+0000 - Removing existing connections, signals and stop signs
2026-06-07 10:08:23 UTC+0000 -       Recreating intersections
2026-06-07 10:08:56 UTC+0000 - Finishing connection rebuild
Make this Notebook Trusted to load map: File -> Trust Notebook


Total running time of the script: (0 minutes 40.697 seconds)

Gallery generated by Sphinx-Gallery