Stacked on comaps/comaps#4162. Do not merge before it.
Summary
Replaces the Python reimplementation of .tempaddr binary encoding and Shapely-based point-in-polygon with a C++ tool that reuses existing infrastructure. Drops the Shapely dependency entirely.
How it works
Before:
OA ZIP → Python (GeoJSON + binary encoding + Shapely point-in-polygon) → .tempaddr
After:
OA ZIP → Python (GeoJSON → TSV to stdout) → oa_processor_tool (CountriesFilesAffiliation + RawEntryBase::Save) → .tempaddr
Changes
Python
- Removed ~200 lines: all binary encoders, _BorderIndex, Shapely imports
- Now outputs 9-column TSV to stdout
- Resolves source license/attribution from OA source JSONs
New C++ (generator/address_parser/)
oa_processor.{hpp,cpp}— TSV parser, region assignment viaCountriesFilesAffiliation,.tempaddrwriter viaRawEntryBase::Save()oa_processor_tool.cpp— gflags entry point- Reuses same code paths as TIGER
address_parser_tool
Attribution
.tempaddrv2 adds optional per-entry attribution strings (source name, license URL, license name)FMD_IMPORTED_SOURCEmetadata carries attribution into MWM files- Backward-incompatible format bump (v1 → v2), old cached files must be regenerated
Other
requirements.txtdropsshapely>=2.0- CI workflow removes
pip install shapelystep run_oa_preprocessor.shpipes Python →oa_processor_tool- CMakeLists.txt adds
oa_processor_tooltarget
Verification
- ✅ C++
oa_processor_toolbuilds and links - ✅
openaddresses-canadastill compiles (no regression) - ✅ Python tests: 46/46 pass
- ✅ Point-in-polygon parity: 84/85 match old Shapely results (1 edge boundary)
- ✅ Attribution round-trip: source_name, license_url, license_name survive .tempaddr binary
- ✅ End-to-end: Python TSV → C++ → .tempaddr → verified via Python deserializer
AI-assisted
Generated with Claude Code. All changes reviewed and verified by a human.
Stacked on https://codeberg.org/comaps/comaps/pulls/4162. Do not merge before it.
## Summary
Replaces the Python reimplementation of `.tempaddr` binary encoding and Shapely-based point-in-polygon with a C++ tool that reuses existing infrastructure. Drops the Shapely dependency entirely.
## How it works
**Before:**
```
OA ZIP → Python (GeoJSON + binary encoding + Shapely point-in-polygon) → .tempaddr
```
**After:**
```
OA ZIP → Python (GeoJSON → TSV to stdout) → oa_processor_tool (CountriesFilesAffiliation + RawEntryBase::Save) → .tempaddr
```
## Changes
### Python
- Removed ~200 lines: all binary encoders, _BorderIndex, Shapely imports
- Now outputs 9-column TSV to stdout
- Resolves source license/attribution from OA source JSONs
### New C++ (`generator/address_parser/`)
- `oa_processor.{hpp,cpp}` — TSV parser, region assignment via `CountriesFilesAffiliation`, `.tempaddr` writer via `RawEntryBase::Save()`
- `oa_processor_tool.cpp` — gflags entry point
- Reuses same code paths as TIGER `address_parser_tool`
### Attribution
- `.tempaddr` v2 adds optional per-entry attribution strings (source name, license URL, license name)
- `FMD_IMPORTED_SOURCE` metadata carries attribution into MWM files
- Backward-incompatible format bump (v1 → v2), old cached files must be regenerated
### Other
- `requirements.txt` drops `shapely>=2.0`
- CI workflow removes `pip install shapely` step
- `run_oa_preprocessor.sh` pipes Python → `oa_processor_tool`
- CMakeLists.txt adds `oa_processor_tool` target
## Verification
- ✅ C++ `oa_processor_tool` builds and links
- ✅ `openaddresses-canada` still compiles (no regression)
- ✅ Python tests: 46/46 pass
- ✅ Point-in-polygon parity: 84/85 match old Shapely results (1 edge boundary)
- ✅ Attribution round-trip: source_name, license_url, license_name survive .tempaddr binary
- ✅ End-to-end: Python TSV → C++ → .tempaddr → verified via Python deserializer
## AI-assisted
Generated with Claude Code. All changes reviewed and verified by a human.