Repository navigation
fix(conflate): treat stores inside their brand's OSM host as departments - #939
Merged
Merged
Conversation
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
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ttfb2HyX6m2N4gcDLAazrJ
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.
Requested by Sascha · project thread
Fixes #930.
What changes
An ATP feature in a department category (pharmacy, alcohol, cafe, …) with a
brand:wikidatais 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 infind_departmentsapplied, so the sixalbertsonsandsafewaypharmacies in #930, 77 to 235 m from their ATP supermarket, still matched the supermarket's building assame.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_inthe host with ruledepartment.How
located_in.rs:department_brands(category and brands of a possible department) andenclosing_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 alocated_inrow 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_m0.Testing
test_enclosing_hostandtest_department_brands;cargo test(all unit and integration tests),cargo clippy --all-targetsandcargo fmt --checkpass.Generated by Claude Code