{"id":50960713,"url":"https://github.com/mapup/mapup-osm-bridge-editor","last_synced_at":"2026-06-18T13:33:07.732Z","repository":{"id":246079731,"uuid":"805202416","full_name":"mapup/mapup-osm-bridge-editor","owner":"mapup","description":"Automation for adding missing bridge data to OSM for accurate truck routing restrictions","archived":false,"fork":false,"pushed_at":"2026-06-03T15:40:54.000Z","size":189,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-06-03T17:14:56.821Z","etag":null,"topics":["bridge","josm-plugin","nbi","openstreetmap","osm"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mapup.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2024-05-24T05:05:08.000Z","updated_at":"2026-06-03T15:45:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"f6a407e8-61d2-4a1c-aae7-20a52489d5c5","html_url":"https://github.com/mapup/mapup-osm-bridge-editor","commit_stats":null,"previous_names":["mapup/edit-osm-add-missing-bridge-for-truck-restriction","mapup/mapup-osm-bridge-editor"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mapup/mapup-osm-bridge-editor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapup%2Fmapup-osm-bridge-editor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapup%2Fmapup-osm-bridge-editor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapup%2Fmapup-osm-bridge-editor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapup%2Fmapup-osm-bridge-editor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mapup","download_url":"https://codeload.github.com/mapup/mapup-osm-bridge-editor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapup%2Fmapup-osm-bridge-editor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34493361,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-18T02:00:06.871Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["bridge","josm-plugin","nbi","openstreetmap","osm"],"created_at":"2026-06-18T13:33:04.316Z","updated_at":"2026-06-18T13:33:07.722Z","avatar_url":"https://github.com/mapup.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mapup-osm-bridge-editor\n\n## Introduction\n\nThis repository contains Python and JavaScript scripts using which we plan to add missing bridge data to OSM and then add truck restriction information to the bridge data included in OSM. This will be a two-phase process. In the first phase, we will add all the missing bridges. In the second phase, we will add truck restriction data to all the bridges. This repository is currently focused on Phase One.\n\n## Architecture\n\n- Two independent association pipelines: **hydrography approach** (NHD stream matching) and **mile-point approach** (LRS interpolation)\n- Hydrography pipeline orchestrated by `hydrography-approach/run-hydrography-pipeline.py`; stages: filter → tag → associate → project-coords-onto-ways → fuzzy-match → deduplicate\n- Mile-point pipeline uses LRS milepoint data to interpolate bridge positions onto OSM way geometries\n- Merge script (`merge-approaches/`) combines outputs from both pipelines\n- JOSM scripting plugin (JS/Jython) splits OSM ways and applies `bridge=yes` tags\n- Inputs: OSM `.pbf` extract (Geofabrik), NBI bridge CSV (FHWA), NHD streams `.gpkg` (USGS)\n- Outputs: `.gpkg` and `.csv` files consumed by JOSM; final upload to OSM is manual\n- All processing is local batch scripts; no persistent services or databases\n- See [docs/architecture.md](docs/architecture.md) for datastore choices, dependencies, and auth model\n\n## Prerequisites\n\n- Python 3.x with packages from [requirements.txt](requirements.txt)\n- [QGIS-LTR](https://qgis.org/en/site/forusers/download.html)\n- Osmium tool: `brew install osmium-tool`\n- GDAL: `brew install gdal`\n\n## Local Setup\n\n1. Clone the repo\n2. Install Python dependencies: `pip install -r requirements.txt`\n3. Download input data (links in each approach section below) into `input-data/\u003cstate\u003e/`\n\n## Config\n\nAll input/output paths for the hydrography pipeline are defined in [`hydrography-approach/config.yml`](hydrography-approach/config.yml). Paths use Jinja2 `{{ state }}` templating; set `state_name` in `run-hydrography-pipeline.py`.\n\n## Deploy / Run\n\n- Hydrography pipeline: `cd hydrography-approach \u0026\u0026 python run-hydrography-pipeline.py`\n- Mile-point pipeline: run scripts in `mile-point-approach/` manually in order\n- Merge outputs: `python merge-approaches/get_merged_association_output.py`\n- JOSM edits: load output `.gpkg` in JOSM and run scripts in `split-ways-using-JOSM/`\n\n## Known Limitations\n\n- Processing is memory-intensive for large state `.pbf` files\n- No automated OSM upload; final edits require manual JOSM review and upload\n- Mile-point approach requires LRS data not bundled in this repo\n\nSee [docs/runbook.md](docs/runbook.md) for failure recovery and operational notes.\n\n## Process Overview\n\nFor a comprehensive description of the process, read this guide: [Overview-Add-missing-bridge-truck-restrictions-to-OSM](https://docs.google.com/document/d/1wzjOeGgahNM9B8nrBH0wPx1IWY3eTRSTkfMtBGokuJY/edit)\n\n## Hydrography Approach\n\n1. **Download Data:**\n   - [OSM Ways Data](https://www.geofabrik.de/): Downloaded from Geofabrik, this project uses updated OSM data extracts for Kentucky.\n     - Data link: [Kentucky-Latest.osm.pbf](https://drive.google.com/file/d/1p_Bejyj7mbCFA_8ohujI2Hy-5F-S6Op-/view?usp=sharing)\n   - [NBI Bridge Dataset](https://infobridge.fhwa.dot.gov/Data/Map): Obtained from the Federal Highway Administration, containing detailed information on bridges and tunnels across the USA.\n     - Data link: [Kentucky-NBI-bridge-data.csv](https://drive.google.com/file/d/1EbHY0RvZieGUjWRiAggxRcwAGA_BIu0F/view?usp=sharing)\n   - [National Hydrography Dataset (NHD)](https://www.usgs.gov/national-hydrography/national-hydrography-dataset): Provides essential water feature details for accurate bridge associations.\n     - Data link: [NHD-Kentucky-Streams-Flowline.gpkg](https://drive.google.com/file/d/1XEIrn9k1-eYbZCRSIacFPiXDT62Hs6SZ/view?usp=sharing)\n2. **Filter \u0026 Process Data:**\n   Within the [filter_data](hydrography-approach/processing_scripts/filter_data) folder, we have two scripts that filter relevant OSM data and NBI bridge data.\n   - **Output:**\n     - [Kentucky-filtered-highways.gpkg](https://drive.google.com/file/d/1brW3ak_0NiwqsYcO-FO-TsYI-2Gkqyqa/view?usp=sharing)\n     - [Kentucky-NBI-bridges.gpkg](https://drive.google.com/file/d/1bAzaOcK1isNqyth0tEa86HAfon-NIHax/view?usp=sharing)\n3. **Tag Data:**\n   To ensure precise associations between NBI bridges and relevant OSM ways, data tagging processes are implemented within the [tag_data](hydrography-approach/processing_scripts/tag_data) folder:\n   - Filter out bridges already in OSM data, near freeway interchanges, or near tunnel=culvert OSM ways.\n   - Tag OSM ways and NBI bridges with nearby NHD streams and OSM ways.\n   - **Outputs:**\n     - Intersections among OSM ways and NHD streams: [OSM-NHD-Intersections.csv](https://drive.google.com/file/d/1SIQ3JWlslpvMItPInYucULJEM0uHXjVN/view?usp=sharing)\n     - OSM ways data tagged with relevant NHD stream data: [OSM-NHD-Join.csv](https://drive.google.com/file/d/1VlRr6OzL1teocrYgBYujUaVdLK0qErZc/view?usp=sharing)\n     - NBI bridge data tagged with nearby OSM ways: [NBI-30-OSM-NHD-Join.csv](https://drive.google.com/file/d/1dz2qvGof9BYS5ONWf9x5S38Oqv70RtDV/view?usp=sharing)\n4. **Associate Data:**\n   Within the [associate_data](hydrography-approach/processing_scripts/associate_data) folder, we have scripts that perform the following steps:\n   - Create associations among NBI-OSM and OSM-NHD data, linking NBI bridges, OSM ways, and NHD water streams.\n   - Determine final OSM ways for NBI bridges based on specified conditions and bridge attributes.\n   - Project final coordinates of NBI bridges onto associated OSM ways.\n   - Calculate match percentages for associated OSM ways' road names.\n   - Remove nearby bridges within 30m based on fuzzy match scores.\n   - **Output:** [Final-bridges-with-percentage-match.csv](https://drive.google.com/file/d/1Ap97_7e0zmypqvC1wGDPJAmrxFGhvc8R/view?usp=sharing)\n\n## Mile-point Approach\n\nThe milepoint approach automates the addition of bridges to OpenStreetMap (OSM) using detailed Linear Referencing System (LRS) data. By leveraging milepoint information from bridge and road datasets, this method accurately locates and integrates missing bridges into OSM.\n\n1. **Integrate Data**\n   - Merge bridge and road datasets including milepoint information\n   - Prepare datasets by cleaning and standardizing column names.\n2. **Associate bridge and road data**\n   - Associate bridges with road segments based on milepoint ranges.\n   - Filter and process left-right lane bridges for accurate representation.\n3. **Interpolate bridges on OSM ways**\n   - Calculate precise bridge positions along road geometries using milepoint data.\n   - Improve accuracy through fuzzy matching of road names and bridge descriptions.\n4. **Match OSM Data**\n   - Match interpolated bridge locations with existing OSM road network.\n   - Select closest OSM ways to each bridge location for integration.\n5. **Export Data**\n   - Generate files containing interpolated bridge points and associated road segments.\n6. **Output**\n   - [Kentucky-osm-road-points.gpkg](https://drive.google.com/file/d/1_firL0QLRn9tgK9rHEp3SVpFOpAtcPyQ/view?usp=sharing)\n\n## Merging Association Approaches\n\nThe [merge-approaches](merge-approaches) folder contains script that merges data from both the NBI-OSM associations approaches and generates a combined output.\n\n- **Output:** [merged-approaches-association-output.csv](https://drive.google.com/file/d/1S1Qsp755ZCCv3omNaBCHkh9YMGLTwh5n/view?usp=sharing)\n\n## Split OSM ways using Python and JOSM\n\n1. **Obtain Bridge Coordinates on OSM Ways:**\n   Within the [obtain_bridge_split_coordinates](split-ways-using-JOSM/obtain_bridge_split_coordinates) folder, we have the script that identifies and positions bridge coordinates equidistant from the midpoint along specified OSM ways.\n   - **Output:** [bridge-osm-association-with-split-coords.csv](https://drive.google.com/file/d/1_eEKMMWVWYTT9_oK8rgNEi2sFnelEmjd/view?usp=sharing)\n2. **Use JOSM to Add Bridge Tags:**\n   Within the [split_ways_add_bridge_tag](split-ways-using-JOSM/split_ways_add_bridge_tag) folder, we have the following scripts:\n   - Add Tags to Bridge Spanning over Single OSM Way:\n     - Script: [01-JOSM-1-split-way-in-place.js](split-ways-using-JOSM/split_ways_add_bridge_tag/01-JOSM-1-split-way-in-place.js)\n     - Utilize the JOSM Scripting Plugin to accurately position bridge locations along existing ways and split ways to incorporate new nodes. This includes adding the \"bridge=yes\" tag to the identified way.\n   - Determine OSM ways covered by bridges which span multiple ways using [NetworkX](https://networkx.org/).\n     - Script: [02-shortest-route-between-two-ways.py](split-ways-using-JOSM/split_ways_add_bridge_tag/02-shortest-route-between-two-ways.py)\n   - Add Tags to Bridge Spanning over Multiple OSM Ways:\n     - Script: [03-JOSM-1-handle-multi-way-bridge.js](split-ways-using-JOSM/split_ways_add_bridge_tag/03-JOSM-1-handle-multi-way-bridge.js)\n     - Using Python libraries Osmium and NetworkX alongside the JOSM Scripting Plugin to update OSM data. This involves finding all OSM way IDs that the bridge spans and ensuring accurate tagging.\n\n## Conclusion\n\nThis repository provides tools and scripts necessary to enhance OSM bridge data using publicly available datasets. By automating the identification, tagging, and association processes, it aims to improve the accuracy and completeness of bridge information within OpenStreetMap.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapup%2Fmapup-osm-bridge-editor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmapup%2Fmapup-osm-bridge-editor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapup%2Fmapup-osm-bridge-editor/lists"}