Skip to content
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

OSM localities joins NE and prefers NE population to calculate population_rank #2048

Merged
merged 18 commits into from
Feb 1, 2022

Conversation

peitili
Copy link
Contributor

@peitili peitili commented Jan 27, 2022

Background

#2020

When zooming across the NE <> OSM boundary around zoom 8, townspots shift position, population_rank values change, and min_zoom values change.

For country labels in the same places theme we do a join on WikidataID and apply the NE min_zoom to the OSM features.

We should do the same type of harvesting for localities. Namely:

OSM localities should get their population_rank and min_zoom values from NE.
The population value should not be adjusted, as that's for the incorporated area, while the NE population_rank is for the metro area and is more useful for label grading in the stylesheet.

Changes

  • Add export functions to export __ne_max_zoom, __ne_min_zoom, __ne_pop_min and __ne_pop_max to the json object
  • Move the estimate population value that introduced in Estimate population for null pop OSM places #1993 to a post_process function as the final fall-back values for population
  • Use the population values from NE to calculate population_rank field
  • Fix a bug that {"population": None} in the json object doesn't end up getting the default estimate population value.

Existing Test Changes

1 Why there is a change necessary for
integration-test.988-add-population-to-collision-rank.PopulationRankTest.test_0 ?

In fact, this test breaks on master too, and this PR fixes it.

2 Why there is a change necessary for
integration-test.988-add-population-to-collision-rank.PopulationRankTest.test_collision_rank_decreasing ?

When the data has tag population: None it falls into following filter line in places.yaml (surprisingly?!)

- filter: {name: true, population: true, place: [city, town]}

and thus it won't have the hardcoded estimate population value 10000 for kind_detail: city, it will have population value be 0.

Because we moved the estimation population backfill logic from the yaml file to the transform function, and the transform function is executed at a later stage than the yaml file logic, now when tag population: None happens, it gets a chance to take the hardcoded estimate population value 10000. And thus the collision_rank value changes and as a result, original test breaks. So one way to make this test pass again and more reasonable is to not start from tag population: None but from population: 0.

  • Update tests
  • Update docs

@peitili peitili changed the title ne joins osm localities NE joins OSM localities and prefers NE population to calculate population_rank Jan 27, 2022
@peitili peitili requested a review from iandees January 27, 2022 22:32
@peitili
Copy link
Contributor Author

peitili commented Jan 27, 2022

I am going to do a mini build on California to generate some rendered tiles to verify the change.

@peitili peitili added this to the v1.9.0 milestone Jan 27, 2022
docs/layers.md Outdated Show resolved Hide resolved
docs/layers.md Outdated Show resolved Hide resolved
data/functions.sql Outdated Show resolved Hide resolved
queries.yaml Outdated Show resolved Hide resolved
@peitili peitili changed the title NE joins OSM localities and prefers NE population to calculate population_rank OSM joins NE localities and prefers NE population to calculate population_rank Jan 28, 2022
@peitili peitili changed the title OSM joins NE localities and prefers NE population to calculate population_rank OSM localities joins NE and prefers NE population to calculate population_rank Jan 28, 2022
@nvkelso
Copy link
Member

nvkelso commented Jan 28, 2022

LGTM but let's see it in a mini build

The CI tests failing are the olds ones, not the new ones.

@peitili peitili force-pushed the travisg/20220111-ne-to-osm-localities branch from ecb4a82 to baceead Compare February 1, 2022 00:52
Copy link
Member

@nvkelso nvkelso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM included Q&A in a mini build.

@peitili peitili merged commit 5307199 into master Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants