Skip to content

Fix OSM→OSW zone _w_id references missing from nodes#51

Merged
sujata-m merged 2 commits into
developfrom
feature-3665
May 20, 2026
Merged

Fix OSM→OSW zone _w_id references missing from nodes#51
sujata-m merged 2 commits into
developfrom
feature-3665

Conversation

@sujata-m
Copy link
Copy Markdown
Contributor

@sujata-m sujata-m commented May 19, 2026

Dev Board Ticket

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 — a minimal file which repo the issue.
  • Regression test: test_osm2osw_zone_boundary_is_osw_compliant in 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-reformatterfrom osm_osw_reformatter.
    • Aligned conda command (python==3.10.3python=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.40.3.5 in version.py with matching 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.

sujata-m added 2 commits May 19, 2026 23:39
## 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
@sujata-m sujata-m requested review from MashB and susrisha May 19, 2026 18:29
@sujata-m sujata-m changed the base branch from main to develop May 19, 2026 18:34
@sujata-m sujata-m merged commit 0f584a9 into develop May 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants