{"id":43676517,"url":"https://github.com/dvrpc/gis-lts-calc","last_synced_at":"2026-02-05T01:09:18.986Z","repository":{"id":334992122,"uuid":"1110868573","full_name":"dvrpc/gis-lts-calc","owner":"dvrpc","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-27T22:07:25.000Z","size":594,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-28T10:50:04.555Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dvrpc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-05T21:08:55.000Z","updated_at":"2026-01-27T22:07:13.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/dvrpc/gis-lts-calc","commit_stats":null,"previous_names":["dvrpc/gis-lts-calc"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/dvrpc/gis-lts-calc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvrpc%2Fgis-lts-calc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvrpc%2Fgis-lts-calc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvrpc%2Fgis-lts-calc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvrpc%2Fgis-lts-calc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dvrpc","download_url":"https://codeload.github.com/dvrpc/gis-lts-calc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvrpc%2Fgis-lts-calc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29105270,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T00:52:08.035Z","status":"ssl_error","status_checked_at":"2026-02-05T00:52:07.703Z","response_time":62,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-02-05T01:09:13.858Z","updated_at":"2026-02-05T01:09:18.971Z","avatar_url":"https://github.com/dvrpc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Level of Traffic Stress (LTS) Calculation\n\nThis project calculates Level of Traffic Stress (LTS) scores on the DVRPC model network. It includes a component for conflating speed data from PennDOT and NJDOT to help with more accurate scoring.\n\n## Overview\n\nThe workflow:\n1. Sets up a PostgreSQL/PostGIS database\n2. Loads PennDOT speed limit data (auto-downloaded)\n3. Loads NJDOT road network with M values (auto-downloaded)\n4. Loads NJDOT speed data (manual CSV from input folder)\n5. Loads DVRPC model network shapefile\n6. Conflates speed data from PennDOT and NJDOT to model network\n7. Calculates LTS scores (1-4)\n8. Cleans up temporary files\n\n## Prerequisites\n\n- PostgreSQL with PostGIS extension\n- Python 3.9+\n- Required tools: `psql`, `ogr2ogr`\n\n## Setup\n\n1. Install Python dependencies:\n```bash\npip install -r requirements.txt\n```\n\n2. Create a `.env` file with your configuration:\n```env\n# PostgreSQL Connection\nPOSTGRES_HOST=localhost\nPOSTGRES_PORT=5432\nPOSTGRES_USER=postgres\nPOSTGRES_PASSWORD=your_password\nPOSTGRES_DB=lts\n\n# Model Network Shapefile (without .shp extension)\nNETWORK_SHAPEFILE=input/bike_network_dec1_2025_link\n```\n\n3. Place your model network shapefile in the `input/` directory and update `NETWORK_SHAPEFILE` in `.env`\n\n4. Copy the lookup tables:\n```bash\ncp -r lookups.example/ lookups/\n```\n\n5. Download NJDOT speed data:\n   - Visit https://njsld.org/NJDOT/SLD/DataBrowser/Speed\n   - Click the Export button to download as CSV\n   - Save the file as `input/Speed.csv`\n\n### Required Model Network Shapefile Fields\n\nYour shapefile must contain these fields:\n- `no` (numeric) - Segment ID\n- `fromnodeno` (numeric) - From node ID\n- `tonodeno` (numeric) - To node ID\n- `typeno` (varchar) - Road type code (72, 79 for residential)\n- `numlanes` (numeric) - Number of lanes\n- `bike_fac~1` (numeric) - Bike facility type (0-9)\n- `vcur_prt~2` (varchar) - Speed field (e.g., \"25mph\")\n- `geom` - Geometry (LineString)\n\n## Usage\n\nRun the complete workflow:\n```bash\npython3 run.py\n```\n\n## Output\n\nFinal table: `output.model_network_with_lts`\n\nContains all original bike network fields plus:\n- `vehiclespeed`: Speed limit (from PennDOT or original data)\n- `final_speed_source`: Source of speed data (penndot or original)\n- `lts`: Level of Traffic Stress score (1-4)\n\n## Files\n\n- `run.py` - Main workflow script\n- `sql/` - SQL scripts\n  - `conflate_speed_data.sql` - conflate DOT speed\n  - `calculate_lts.sql` - LTS calculation using DVRPC methodology\n  - `njdot_speed_to_geometry.sql` - NJDOT speed csv geometry mapping\n- `lookups/` - Lookup tables for LTS calculation (gitignored, copy from `lookups.example/`)\n- `lookups.example/` - Example lookup tables (tracked in git)\n- `old_lts.py` - Reference: Original LTS methodology from Visum\n- `requirements.txt` - Python dependencies\n- `.env` - Database configuration (create this)\n\n## Customizing LTS Scoring\n\nThe LTS calculation uses two lookup tables in the `lookups/` folder that can be adjusted to modify scoring:\n\n### Setup\n\nCopy the example lookup files to create your local versions:\n```bash\ncp -r lookups.example/ lookups/\n```\n\n### lts_lookup.csv\n\nThis table defines the LTS score for each combination of road characteristics and bike facility type. Each row specifies:\n- Lane count ranges (`min_lanes`, `max_lanes`)\n- Speed ranges (`min_speed`, `max_speed`)\n- Whether the rule applies to residential roads (`is_residential`)\n- LTS scores (1-4) for each bike facility type\n\nYou can adjust the LTS values in the facility columns to change how different road/facility combinations are scored.\n\n### bike_facility_lookup.csv\n\nThis table maps bike facility codes from your network data to the column names used in `lts_lookup.csv`. Modify this if your network uses different facility codes or if you want to reclassify certain facility types.\n\n## Bike Facility Codes\n\nThe `bike_fac~1` field should use these codes:\n- `0` - No bike facility\n- `1` - Sharrows\n- `2` - Bike Lane\n- `3` - Buffered Bike Lane\n- `4` - Multi-use Trail\n- `5` - Signed Bike Route\n- `6` - Protected Bike Lane\n- `9` - Opposite direction of one-way street\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvrpc%2Fgis-lts-calc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdvrpc%2Fgis-lts-calc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvrpc%2Fgis-lts-calc/lists"}