Fix OSM→OSW zone _w_id references missing from nodes#51
Merged
Conversation
## Dev Board Ticket - https://dev.azure.com/TDEI-UW/TDEI/_workitems/edit/3665 - https://dev.azure.com/TDEI-UW/TDEI/_workitems/edit/3191/ ## Changes - **Zone boundary protection in `construct_geometries()`**: collect zone boundary IDs from `_w_id` lists and filter them out of `internal_nodes` before `self.G.remove_nodes_from(...)`. This prevents zone boundary nodes from being deleted by simplification edge cases (e.g., circular-way neighbor combination), so they remain in `node_id_map` for `_w_id` → sequential `_id` remapping in `to_geojson()`. - **Regression fixture**: added [tests/unit_tests/test_files/zone_boundary.xml](tests/unit_tests/test_files/zone_boundary.xml) — a minimal `highway=pedestrian` plaza plus connecting footways with simplifiable intermediate nodes. - **Regression test**: `test_osm2osw_zone_boundary_is_osw_compliant` in [test_osm_compliance.py](tests/unit_tests/test_osm_compliance/test_osm_compliance.py) runs `Formatter.osm2osw()`, zips the output, and asserts `OSWValidation` reports zero issues. - **README fixes**: - Corrected invalid Python import `from osm-osw-reformatter` → `from osm_osw_reformatter`. - Aligned conda command (`python==3.10.3` → `python=3.10`) with the documented 3.10.x requirement. - Updated sample snippet to `return` the result and access `results.generated_files`. - **Version bump**: `0.3.4` → `0.3.5` in [version.py](src/osm_osw_reformatter/version.py) with matching [CHANGELOG.md](CHANGELOG.md) entry. ## Testing - Ran the full compliance test suite — all 3 pass, including the new zone-boundary regression test: ``` pytest tests/unit_tests/test_osm_compliance/ ===== 3 passed in 4.81s ===== ``` - Validated end-to-end via the `example.py` flow (`osm2osw` → zip → `python-osw-validation`) on the fixture: zero validation issues reported.
- Add coverage configuration - Add Codecov badge and coverage upload workflow - Add zone boundary XML fixture for _w_id validation repro
MashB
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dev Board Ticket
Changes
construct_geometries(): collect zone boundary IDs from_w_idlists and filter them out ofinternal_nodesbeforeself.G.remove_nodes_from(...). This prevents zone boundary nodes from being deleted by simplification edge cases (e.g., circular-way neighbor combination), so they remain innode_id_mapfor_w_id→ sequential_idremapping into_geojson().tests/unit_tests/test_files/zone_boundary.xml— a minimal file which repo the issue.test_osm2osw_zone_boundary_is_osw_compliantintest_osm_compliance.pyrunsFormatter.osm2osw(), zips the output, and assertsOSWValidationreports zero issues.from osm-osw-reformatter→from osm_osw_reformatter.python==3.10.3→python=3.10) with the documented 3.10.x requirement.returnthe result and accessresults.generated_files.0.3.4→0.3.5inversion.pywith matchingCHANGELOG.mdentry.Testing
pytest tests/unit_tests/test_osm_compliance/ ===== 3 passed in 4.81s =====example.pyflow (osm2osw→ zip →python-osw-validation) on the fixture: zero validation issues reported.