kopia lustrzana https://github.com/openmaptiles/openmaptiles
Set rank of countries with limited recognition to 6
rodzic
30539e78d1
commit
b88b34c98d
|
@ -49,6 +49,15 @@ tables:
|
||||||
- *name_en
|
- *name_en
|
||||||
- *name_de
|
- *name_de
|
||||||
- *rank
|
- *rank
|
||||||
|
- name: country_code_iso3166_1_alpha_2
|
||||||
|
key: country_code_iso3166_1_alpha_2
|
||||||
|
type: string
|
||||||
|
- name: iso3166_1_alpha_2
|
||||||
|
key: ISO3166-1:alpha2
|
||||||
|
type: string
|
||||||
|
- name: iso3166_1
|
||||||
|
key: ISO3166-1
|
||||||
|
type: string
|
||||||
- name: tags
|
- name: tags
|
||||||
type: hstore_tags
|
type: hstore_tags
|
||||||
filters:
|
filters:
|
||||||
|
|
|
@ -10,16 +10,23 @@ CREATE OR REPLACE FUNCTION update_osm_country_point() RETURNS VOID AS $$
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
UPDATE osm_country_point AS osm
|
UPDATE osm_country_point AS osm
|
||||||
SET "rank" = 7;
|
SET
|
||||||
|
"rank" = 7,
|
||||||
|
iso3166_1_alpha_2 = COALESCE(
|
||||||
|
NULLIF(osm.country_code_iso3166_1_alpha_2, ''),
|
||||||
|
NULLIF(osm.iso3166_1_alpha_2, ''),
|
||||||
|
NULLIF(osm.iso3166_1, '')
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
WITH important_country_point AS (
|
WITH important_country_point AS (
|
||||||
SELECT osm.geometry, osm.osm_id, osm.name, COALESCE(NULLIF(osm.name_en, ''), ne.name) AS name_en, ne.scalerank, ne.labelrank
|
SELECT osm.geometry, osm.osm_id, osm.name, COALESCE(NULLIF(osm.name_en, ''), ne.name) AS name_en, ne.scalerank, ne.labelrank
|
||||||
FROM ne_10m_admin_0_countries AS ne, osm_country_point AS osm
|
FROM ne_10m_admin_0_countries AS ne, osm_country_point AS osm
|
||||||
WHERE
|
WHERE
|
||||||
-- We only match whether the point is within the Natural Earth polygon
|
-- We match only countries with ISO codes to eliminate disputed countries
|
||||||
-- because name matching is to difficult since OSM does not contain good
|
-- that lies inside polygon of sovereign country
|
||||||
-- enough coverage of ISO codesy
|
iso3166_1_alpha_2 IS NOT NULL
|
||||||
ST_Within(osm.geometry, ne.geometry)
|
AND ST_Within(osm.geometry, ne.geometry)
|
||||||
-- We leave out tiny countries
|
-- We leave out tiny countries
|
||||||
AND ne.scalerank <= 1
|
AND ne.scalerank <= 1
|
||||||
)
|
)
|
||||||
|
@ -48,7 +55,8 @@ BEGIN
|
||||||
FROM osm_country_point osm,
|
FROM osm_country_point osm,
|
||||||
ne_10m_admin_0_countries AS ne
|
ne_10m_admin_0_countries AS ne
|
||||||
WHERE
|
WHERE
|
||||||
NOT (osm."rank" BETWEEN 1 AND 6)
|
iso3166_1_alpha_2 IS NOT NULL
|
||||||
|
AND NOT (osm."rank" BETWEEN 1 AND 6)
|
||||||
)
|
)
|
||||||
UPDATE osm_country_point AS osm
|
UPDATE osm_country_point AS osm
|
||||||
-- Normalize both scalerank and labelrank into a ranking system from 1 to 6
|
-- Normalize both scalerank and labelrank into a ranking system from 1 to 6
|
||||||
|
|
Ładowanie…
Reference in New Issue