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

more rigorous countries labels per ISO and point-of-view #2069

Merged
merged 66 commits into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
e005a1a
Hide non NE countries with a non rendering min zoom
Apr 13, 2022
210e038
different value
Apr 14, 2022
91920b7
Revert "different value"
Apr 14, 2022
3dc0880
different value
Apr 14, 2022
9f78406
testing
Apr 14, 2022
ee7ccbf
set value to non rendering
Apr 20, 2022
3bb7e0d
Update kind rather than min_zoom
Apr 21, 2022
9fec9d2
Merge remote-tracking branch 'origin/master' into junderwood/hide_non…
Apr 29, 2022
0976306
updates
May 2, 2022
e853595
updating to newest date in assets.yaml
tgrigsby-sc Apr 28, 2022
fc1f2c6
updating assets.yaml
tgrigsby-sc Apr 29, 2022
776ff67
updating assets.yaml to pull from 5.1.0 now
tgrigsby-sc May 4, 2022
b05b25d
split lookup depending on whether it's a country (#2075)
tgrigsby-sc May 4, 2022
b810954
return fclass_iso, fclass_tlc, and label_x, label_y for OSM features …
tgrigsby-sc May 4, 2022
b51e372
adding TLC POV to NE export, YAML files and transform.py (#2081)
tgrigsby-sc May 4, 2022
e0fa3de
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 4, 2022
2135ec4
Sql to recast countries
May 5, 2022
3e7f837
Merge remote-tracking branch 'origin/travisg/20220428-add-NE-support-…
May 5, 2022
0004a79
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 5, 2022
a4b218a
updating comment
tgrigsby-sc May 5, 2022
9581f99
Added some filters to country matching
May 5, 2022
262cdc4
Merge remote-tracking branch 'origin/junderwood/hide_non_ne_countries…
May 5, 2022
1a8a020
updating prj for admin_0 countries assets
tgrigsby-sc May 5, 2022
a677b3b
Merge remote-tracking branch 'origin/travisg/20220428-add-NE-support-…
May 5, 2022
9af84a0
fixed typo in name
May 6, 2022
3ba8648
update .gitignore
tgrigsby-sc May 6, 2022
31a5b4a
PR feedback
tgrigsby-sc May 6, 2022
4bd8870
add back changes
May 7, 2022
761ae3c
adding tests
tgrigsby-sc May 9, 2022
2635448
updating assets file to 5.1.1, removing projection spec
tgrigsby-sc May 9, 2022
ef54ab6
Merge remote-tracking branch 'origin/travisg/20220428-add-NE-support-…
May 9, 2022
2e59334
disambiguate
tgrigsby-sc May 11, 2022
1185427
adding disadmbiguation
tgrigsby-sc May 13, 2022
24c86c9
upgrading to 5.1.2
tgrigsby-sc May 13, 2022
8fb9226
updating shapefile again
tgrigsby-sc May 16, 2022
520379b
Merge remote-tracking branch 'origin/travisg/20220428-add-NE-support-…
May 16, 2022
c126fe2
fixed typo
May 16, 2022
de0152f
fixed typo
May 16, 2022
f03e139
Change to use featurecla for comparison. Update country min zoom with…
May 17, 2022
6db321e
Merge remote-tracking branch 'origin/master' into junderwood/hide_non…
May 17, 2022
9d59e59
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 17, 2022
3801e76
update test
May 17, 2022
ffced45
Merge remote-tracking branch 'origin/junderwood/hide_non_ne_countries…
May 17, 2022
2539901
fixed typo in lua
May 17, 2022
2344be2
Need to alter column length
May 17, 2022
a23f6d1
wrong column name
May 17, 2022
4985dff
add semicolon for neatness
May 17, 2022
09f1317
Comment fixes
May 18, 2022
4dfcd71
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 18, 2022
18efd2e
set abkhazia to state
May 18, 2022
7e94a70
Merge remote-tracking branch 'origin/junderwood/hide_non_ne_countries…
May 18, 2022
3371bfc
Merge remote-tracking branch 'origin/master' into junderwood/hide_non…
May 18, 2022
880c5ae
fixes
May 19, 2022
892768f
typo
May 19, 2022
8534815
change to dependency
May 20, 2022
0896166
Add aland
May 20, 2022
f83baa8
typo
May 20, 2022
8e4ac66
typo
May 20, 2022
da2fc8f
additional countries and country name changes
May 20, 2022
521f695
corrected labels and place type for saint martin
May 20, 2022
aee116e
added max zoom for unrecognized and missing entries in country.yaml
May 21, 2022
82ca29e
fix issue
May 21, 2022
8644fbe
remove max zoom change for now
May 21, 2022
5506e3a
minor formatting improvement
May 21, 2022
5f1603b
added more countries
May 23, 2022
a24dd9b
formatting
May 23, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions data/apply-ne_country_label_recasting.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
-- Recasts a few rows in the ne_10m_admin_0_countries_iso and ne_10m_admin_0_countries_tlc
-- tables to either show or hide certain labels.
-- The TLC table yields around 10 country and dependency features over ISO (including Kosovo and Taiwan),
-- which Tilezen sometimes has opinions about.


nvkelso marked this conversation as resolved.
Show resolved Hide resolved
-- sets featurcla to equal fclass_tlc values. We can then further modify the values while keeping the fclass intact.
nvkelso marked this conversation as resolved.
Show resolved Hide resolved
-- featurecla column has a shorter varchar length and needs altering first.
alter table ne_10m_admin_0_countries_tlc alter column featurecla type varchar;
update ne_10m_admin_0_countries_tlc set featurecla = fclass_tlc;

-- Akrotiri Sovereign Base Area
update ne_10m_admin_0_countries_tlc set featurecla = 'unrecognized' where ne_id = 1159320741;

-- Ashmore and Cartier Islands
update ne_10m_admin_0_countries_tlc set featurecla = 'unrecognized' where ne_id = 1159320353;

-- Clipperton Island
update ne_10m_admin_0_countries_tlc set featurecla = 'unrecognized' where ne_id = 1159320635;

-- Coral Sea Islands
update ne_10m_admin_0_countries_tlc set featurecla = 'unrecognized' where ne_id = 1159320359;

-- Dhekelia Cantonment
update ne_10m_admin_0_countries_tlc set featurecla = 'unrecognized' where ne_id = 1159320709;

-- Gaza Strip
update ne_10m_admin_0_countries_tlc set featurecla = 'Admin-0 country' where ne_id = 1159320901;
jeffdefacto marked this conversation as resolved.
Show resolved Hide resolved

-- Somaliland
update ne_10m_admin_0_countries_tlc set featurecla = 'unrecognized' where ne_id = 1159321259;

-- Turkish Republic of Northern Cyprus
update ne_10m_admin_0_countries_tlc set featurecla = 'unrecognized' where ne_id = 1159320531;

-- West Bank
update ne_10m_admin_0_countries_tlc set featurecla = 'Admin-0 dependency' where ne_id = 1159320903;


jeffdefacto marked this conversation as resolved.
Show resolved Hide resolved
-- Fix Saint Helena wikidata id for this build. Remove once NE is updated
update ne_10m_admin_0_countries_iso set wikidataid = 'Q192184' where ne_id = 1159320733;
6 changes: 4 additions & 2 deletions data/functions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,8 @@ BEGIN
SELECT
min_label, max_label INTO min_zoom, max_zoom
FROM ne_10m_admin_0_countries_tlc t
WHERE t.wikidataid = wikidata_id;
WHERE t.wikidataid = wikidata_id
AND featurecla IN ('Admin-0 country', 'Admin-0 dependency');
END IF;
ELSE
-- try states and provinces if it's not a country
Expand Down Expand Up @@ -1071,7 +1072,8 @@ END IF;
SELECT
t.fclass_iso, t.fclass_tlc, t.label_x, t.label_y INTO fclass_iso_var, fclass_tlc_var, label_x_var, label_y_var
FROM ne_10m_admin_0_countries_tlc t
WHERE t.wikidataid = wikidata_id;
WHERE t.wikidataid = wikidata_id
AND featurecla IN ('Admin-0 country', 'Admin-0 dependency');
END IF;

IF NOT FOUND THEN
Expand Down
5 changes: 5 additions & 0 deletions data/perform-sql-updates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ psql $PSQLOPTS $@ -f apply-planet_disputed_area_features_name_suppression.sql
echo -e "\nRecasting unwanted NE disputed lines to unrecognized"
psql $PSQLOPTS $@ -f apply-ne_disputed_border_suppression.sql

# Recasts a few rows in the ne_10m_admin_0_countries_iso and ne_10m_admin_0_countries_tlc
# tables to either show or hide certain labels.
echo -e "\nRecasting NE country labels"
psql $PSQLOPTS $@ -f apply-ne_country_label_recasting.sql

# Australia suburbs are treated more like cities than typical US style suburbs so we recast them to place=town
echo -e "\nRecasting Australia suburbs"
psql $PSQLOPTS $@ -f apply-planet_australia_suburb_recast.sql
Expand Down
4 changes: 2 additions & 2 deletions integration-test/1826-unrecognised-country-labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def test_country_no_ne(self):

self.assert_has_feature(
z, x, y, 'places', {
'kind': 'country',
'min_zoom': 6,
'kind': 'unrecognized',
'min_zoom': 8,
})

def test_region_no_ne(self):
Expand Down
4 changes: 2 additions & 2 deletions osm2pgsql.lua
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ function osm2pgsql.process_node(object)
end
-- Show Abkhazia label as region for most countries
if object.tags.place and object.tags.wikidata == 'Q23334' then
output_hstore['place'] = 'region'
output_hstore['place'] = 'state'
output_hstore['place:RU'] = 'country'
end
-- Turn off South Ossetia label for most countries
Expand Down Expand Up @@ -557,7 +557,7 @@ function osm2pgsql.process_node(object)
output_hstore['place'] = 'country'
end
-- New Caledonia
if object.tags.place == 'archipelago' and object.tags['ISO3166-1'] == 'NF' then
if object.tags.place == 'archipelago' and object.tags['ISO3166-1'] == 'NC' then
output_hstore['place'] = 'country'
end
-- Norfolk Island
Expand Down
5 changes: 3 additions & 2 deletions vectordatasource/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -8906,13 +8906,14 @@ def tags_set_ne_min_max_zoom(ctx):
min_zoom = ceil(min_zoom)
props['min_zoom'] = min_zoom

elif props.get('kind') == 'country':
elif props.get('kind') in ('country', 'unrecognized'):
# countries and regions which don't have a min zoom joined from NE
# are probably either vandalism or unrecognised countries. either
# way, we probably don't want to see them at zoom, which is lower
# than most of the curated NE min zooms. see issue #1826 for more
# information.
props['min_zoom'] = max(6, props['min_zoom'])
nvkelso marked this conversation as resolved.
Show resolved Hide resolved
props['kind'] = 'unrecognized'
props['min_zoom'] = max(8, props['min_zoom'])
nvkelso marked this conversation as resolved.
Show resolved Hide resolved

elif props.get('kind') == 'region':
props['min_zoom'] = max(8, props['min_zoom'])
Expand Down
6 changes: 5 additions & 1 deletion yaml/places.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ filters:
#
# note: also, we knock this down to 6 during post-processing for any country
# which doesn't match an NE curated one.
min_zoom: 1
min_zoom:
case:
- when: { place: country }
then: 1
- else: 8
output:
<<: [*output_properties, *ne_zooms]
kind: {col: place}
Expand Down