-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change order of region/macroregion layers when doing search #325
Change order of region/macroregion layers when doing search #325
Conversation
8af59b7
to
c6075e8
Compare
c6075e8
to
c89b982
Compare
Hey @missinglink @orangejulius WDYT about this? May be I don't get something or it is indeed a bug? |
Hmm yeah I think this is a very nice catch :) The good news is it probably affects very little. There are only 96 active And even then, only if there are no relevant lower layers (neighbourhood, locality, localadmin, county, etc). For example, for an address record to be missing a region when it should have one, I think it would have to not be contained by any admin area lower than region (for example neighbourhood, localadmin, locality, etc which are all quite common). I can see how Azerbaijan could be one of those places since it has macroregions and (presumably) a lot of unincorporated land that might not have any lower admin areas. I was curious and I did some querying, in a recent planet build their are 127k addresses and 383k total records that have a macroregion but no region. Some of those will be legitimate, I'm sure there are places with a macroregion but no region. Some are wrong though, for example Eizaguirre Auzoa 331, Basque Country, Spain should be parented by both the Gipuzkoa region and Basque Country macroregion within Spain. We've had lots of issues with macroregion over the years, and it looks like this is a genuine mistake from 8 years ago 😱, so I think we should probably merge this. That said I recall we've had to think carefully about ordered lists of layers in other places in the code. @missinglink can you think of any considerations that are relevant here? |
@missinglink this looks good, right? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
https://github.com/whosonfirst/whosonfirst-placetypes
Includes a fix for macroregions/region ordering from pelias/wof-admin-lookup#325
Includes a fix for macroregions/region ordering from pelias/wof-admin-lookup#325
Includes a fix for macroregions/region ordering from pelias/wof-admin-lookup#325
Includes a fix for macroregions/region ordering from pelias/wof-admin-lookup#325
Includes a fix for macroregions/region ordering from pelias/wof-admin-lookup#325
Includes a fix for macroregions/region ordering from pelias/wof-admin-lookup#325
Includes a fix for macroregions/region ordering from pelias/wof-admin-lookup#325
Includes a fix for macroregions/region ordering from pelias/wof-admin-lookup#325
👋 I did some awesome work for the Pelias project and would love for everyone to have a look at it and provide feedback.
Here's the reason for this change 🚀
Basically how I bumped into it: we noticed that even though there is WOF data in Azerbaijan for
region
it is not returned from PIP service in many cases:I started digging and noticed that order of layers is important, because (as I understand) we are trying to find the lowest one first and then simply use hierarchy to resolve the rest of them. Here since
marcoregion
goes first in the list of layers + there is macroregions data for Azerbaijan we basically never return region data from this service.After changing the order it works as expected:

Worth saying that according https://github.com/whosonfirst/whosonfirst-placetypes macroregion indeed should be > region.
Here's what actually got changed 👏
Here's how others can test the changes 👀
I haven't added any tests, please let me know WDYT first and then I can try come up with some test for it.