Skip to content

fix(conflate): treat stores inside their brand's OSM host as departments - #939

Merged
brawer merged 2 commits into
mainfrom
fix-930-enclosing-host
Nov 12, 2026
Merged

brawer merged 2 commits into
mainfrom
fix-930-enclosing-host

Conversation

@brawer

@brawer brawer commented Nov 11, 2026

Copy link
Copy Markdown
Owner

Requested by Sascha · project thread

Fixes #930.

What changes

An ATP feature in a department category (pharmacy, alcohol, cafe, …) with a brand:wikidata is now also a department when its position lies inside an OSM feature of a host category (supermarket, hypermarket, department store, furniture, wholesale) of the same brand. The distance to the ATP supermarket doesn't matter then. Before, only the 75 m rule in find_departments applied, so the six albertsons and safeway pharmacies in #930, 77 to 235 m from their ATP supermarket, still matched the supermarket's building as same.

Once such a host is found, the usual department rules apply: the feature doesn't match the host or other department categories, may still match its own OSM pharmacy, and if nothing matches, its row is located_in the host with rule department.

How

  • located_in.rs: department_brands (category and brands of a possible department) and enclosing_host (whether an OSM candidate is a host of that brand that contains the point; geometry is decoded only for host-category stores of the brand).
  • produce_rows: for a branded department-category feature without a known host, the OSM candidates are held until all are seen, so that a host found among them excludes every candidate it should, then scored as before. Other features stream as before. Hosts found this way are remembered by ordinal, so the second (exclusive) pass gives unmatched ones a located_in row too.

I used containment only. The second idea in the issue (the ATP supermarket matched the same OSM feature) would need the result of matching before the pharmacy is matched, and the six cases all have distance_m 0.

Testing

  • New unit tests test_enclosing_host and test_department_brands; cargo test (all unit and integration tests), cargo clippy --all-targets and cargo fmt --check pass.
  • Not run on real data. A US extract with the six cases (Alaska, Texas, Nevada, Washington, California) would confirm them.

Generated by Claude Code

An ATP pharmacy, liquor store or other department-category feature
whose position lies inside an OSM supermarket (or other host-category
store) of its own brand:wikidata is now a department, however far the
spider put the ATP supermarket. Before, such a feature was only a
department if the ATP host was within 75 m, so six albertsons and
safeway pharmacies 77 to 235 m from their ATP supermarket still matched
the supermarket's building as `same`.

Fixes #930.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ttfb2HyX6m2N4gcDLAazrJ
@brawer brawer self-assigned this Nov 11, 2026
@brawer
brawer merged commit 27db852 into main Nov 12, 2026
4 checks passed
@brawer
brawer deleted the fix-930-enclosing-host branch November 12, 2026 09:38
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.

Pharmacies 75–235 m from their ATP supermarket still match the supermarket

2 participants