This project calculates Level of Traffic Stress (LTS) scores on the DVRPC model network. It also includes a component with conflating speed data from Overture Maps to help with more accurate scoring.
The workflow:
- Sets up a PostgreSQL/PostGIS database
- Loads Overture Maps transportation segment data
- Loads DVRPC model network shapefile
- Conflates speed data from Overture to model network
- Calculates LTS scores (1-4)
- Cleans up temporary files
- PostgreSQL with PostGIS extension
- Python 3.9+
- Required tools:
psql,ogr2ogr
- Install Python dependencies:
pip install -r requirements.txt- Create a
.envfile with your configuration:
# PostgreSQL Connection
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_USER=postgres
POSTGRES_PASSWORD=your_password
POSTGRES_DB=lts
# Overture Maps Configuration
OVERTURE_VERSION=2025-11-19.0
# Overture Maps download bounding box (west, south, east, north)
BBOX_WEST=-76.210785
BBOX_SOUTH=39.478606
BBOX_EAST=-73.885803
BBOX_NORTH=40.601963
# Model Network Shapefile (without .shp extension)
BIKE_NETWORK_SHAPEFILE=input/bike_network_dec1_2025_link- Place your model network shapefile in the
input/directory and updateNETWORK_SHAPEFILEin.env
Your shapefile must contain these fields:
no(numeric) - Segment IDfromnodeno(numeric) - From node IDtonodeno(numeric) - To node IDtypeno(varchar) - Road type code (72, 79 for residential)numlanes(numeric) - Number of lanesbike_fac~1(numeric) - Bike facility type (0-9)vcur_prt~2(varchar) - Speed field (e.g., "25mph")geom- Geometry (LineString)
Run the complete workflow:
python3 run.pyFinal table: output.model_network_with_lts
Contains all original bike network fields plus:
speed_mph: Speed limit (from Overture or original data)posted_speed: Speed from Overture conflation (if available)lts: Level of Traffic Stress score (1-4, or -1/-2 for special cases)
run.py- Main workflow scriptconflate_speed_data.sql- Spatial conflation logiccalculate_lts.sql- LTS calculation using DVRPC methodologyold_lts.py- Reference: Original LTS methodology from Visumrequirements.txt- Python dependencies.env- Database configuration (create this)
The bike_fac~1 field should use these codes:
0- No bike facility1- Bike lane2- Buffered bike lane3- Protected bike lane / cycle track4- Shared lane markings (sharrows)5- Paved shoulder6- Separate path9- Opposite direction of one-way street
- The overture_roads.geojson file (1.7GB) is automatically removed after loading to save space
- Speed data is preferentially taken from Overture Maps, falling back to original
vcur_prt~2field - The conflation uses spatial matching with 10m buffer and bearing alignment (±20°)