Pipeline

Signal Overlay ETL

Coverage: Coverage window unavailable for this page.

Built 2026-06-15 11:52 UTC · Commit e5cf673

Page Navigation

Data Provenance

flowchart LR
  11_signal_overlay(["Signal Overlay ETL"])
  f1_11_signal_overlay[/"data/osm-signals/traffic_signals_raw.json"/] --> 11_signal_overlay
  f2_11_signal_overlay[/"data/GTFS/shapes.txt"/] --> 11_signal_overlay
  f3_11_signal_overlay[/"data/GTFS/trips.txt"/] --> 11_signal_overlay
  a1_11_signal_overlay{"OpenStreetMap Overpass API"} --> 11_signal_overlay
  11_signal_overlay --> tp_route_signals[("route_signals")]
  classDef page fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a,stroke-width:2px;
  classDef table fill:#ecfeff,stroke:#0e7490,color:#164e63;
  classDef dep fill:#fff7ed,stroke:#c2410c,color:#7c2d12,stroke-dasharray: 4 2;
  classDef file fill:#eef2ff,stroke:#6366f1,color:#3730a3;
  classDef api fill:#f0fdf4,stroke:#16a34a,color:#14532d;
  classDef pipeline fill:#f5f3ff,stroke:#7c3aed,color:#4c1d95;
  class 11_signal_overlay page;
  class tp_route_signals table;
  class f1_11_signal_overlay,f2_11_signal_overlay,f3_11_signal_overlay file;
  class a1_11_signal_overlay api;

Findings

Findings: Signal Overlay ETL

Summary

Route-level traffic signal exposure metrics are computed from OpenStreetMap traffic-signal nodes and written to prt.db.

Notes

  • Each route's signal count is the number of unique signals within 30 m of its densified GTFS shape; signal_density divides this by the route's longest shape length.
  • Matching diagnostics include n_route_points and match_rate.
  • Cached Overpass responses are reused when available.

Methods

Methods: Signal Overlay ETL

Question

How many traffic signals does each transit route pass, and what is its signal density?

Approach

  1. Fetch or read cached OpenStreetMap highway=traffic_signals nodes for the Allegheny County bounding box via the Overpass API.
  2. Load GTFS route geometry; compute each route's representative length as the length of its longest single GTFS shape (an ordered polyline).
  3. Build a KDTree of signal points and, for each densified route shape, count the unique signals within 30 m.
  4. Compute signal_density = n_signals / length_km.
  5. Rebuild route_signals in prt.db.

Data

  • OpenStreetMap Overpass traffic-signal nodes
  • GTFS shapes.txt and trips.txt
  • Cached Overpass JSON under data/osm-signals/

Output

  • route_signals table in data/prt.db

Source Code

"""Pipeline 11: load route-level traffic signal exposure metrics into prt.db."""

from prt_otp_analysis.signal_overlay import main as signal_main


def main() -> None:
    """Run signal overlay ETL."""
    signal_main()


if __name__ == "__main__":
    main()

Tables Produced

TableDescription
route_signals Route-level traffic signal count, representative route length, and signal density.

Sources

NameTypeWhy It MattersOwnerFreshnessCaveat
data/osm-signals/traffic_signals_raw.json file Cached OpenStreetMap Overpass response of traffic-signal nodes for Allegheny County. Local project data owner not specified. Snapshot file; refresh by rerunning its pipeline step. May lag upstream source updates.
data/GTFS/shapes.txt file GTFS route shape geometry points. Local project data owner not specified. Snapshot file; refresh by rerunning its pipeline step. May lag upstream source updates.
data/GTFS/trips.txt file GTFS shape-to-route mapping. Local project data owner not specified. Snapshot file; refresh by rerunning its pipeline step. May lag upstream source updates.
OpenStreetMap Overpass API api Public query endpoint for OSM nodes tagged highway=traffic_signals. Hosted by overpass-api.de. Queried during pipeline execution; freshness depends on upstream updates. Availability and schema can change without notice.