kopia lustrzana https://github.com/openmaptiles/openmaptiles
Switch place class back to place value
rodzic
7e49a7ebfc
commit
227b36c0d6
|
@ -0,0 +1,8 @@
|
||||||
|
CREATE OR REPLACE FUNCTION normalize_capital_level(capital TEXT)
|
||||||
|
RETURNS INT AS $$
|
||||||
|
SELECT CASE
|
||||||
|
WHEN capital IN ('yes', '2') THEN 2
|
||||||
|
WHEN capital = '4' THEN 4
|
||||||
|
ELSE NULL
|
||||||
|
END;
|
||||||
|
$$ LANGUAGE SQL IMMUTABLE STRICT;
|
|
@ -1,18 +0,0 @@
|
||||||
CREATE OR REPLACE FUNCTION place_class(place TEXT)
|
|
||||||
RETURNS TEXT AS $$
|
|
||||||
SELECT CASE
|
|
||||||
WHEN place IN ('city', 'town', 'village', 'hamlet', 'isolated_dwelling') THEN 'settlement'
|
|
||||||
WHEN place IN ('suburb', 'neighbourhood') THEN 'subregion'
|
|
||||||
WHEN place IN ('locality', 'farm') THEN 'other'
|
|
||||||
ELSE NULL
|
|
||||||
END;
|
|
||||||
$$ LANGUAGE SQL IMMUTABLE STRICT;
|
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION normalize_capital_level(capital TEXT)
|
|
||||||
RETURNS INT AS $$
|
|
||||||
SELECT CASE
|
|
||||||
WHEN capital IN ('yes', '2') THEN 2
|
|
||||||
WHEN capital = '4' THEN 4
|
|
||||||
ELSE NULL
|
|
||||||
END;
|
|
||||||
$$ LANGUAGE SQL IMMUTABLE STRICT;
|
|
|
@ -8,22 +8,22 @@
|
||||||
-- etldoc: layer_city -> layer_place
|
-- etldoc: layer_city -> layer_place
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION layer_place(bbox geometry, zoom_level int, pixel_width numeric)
|
CREATE OR REPLACE FUNCTION layer_place(bbox geometry, zoom_level int, pixel_width numeric)
|
||||||
RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text, class text, subclass text, "rank" int, capital INT) AS $$
|
RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text, class text, "rank" int, capital INT) AS $$
|
||||||
SELECT
|
SELECT
|
||||||
osm_id, geometry, name, name_en,
|
osm_id, geometry, name, name_en,
|
||||||
'continent' AS class, 'continent' AS subclass, 1 AS "rank", NULL::int AS capital
|
'continent' AS class, 1 AS "rank", NULL::int AS capital
|
||||||
FROM osm_continent_point
|
FROM osm_continent_point
|
||||||
WHERE geometry && bbox AND zoom_level < 4
|
WHERE geometry && bbox AND zoom_level < 4
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT
|
SELECT
|
||||||
osm_id, geometry, name, COALESCE(NULLIF(name_en, ''), name) AS name_en,
|
osm_id, geometry, name, COALESCE(NULLIF(name_en, ''), name) AS name_en,
|
||||||
'country' AS class, 'country' AS subclass,"rank", NULL::int AS capital
|
'country' AS class,"rank", NULL::int AS capital
|
||||||
FROM osm_country_point
|
FROM osm_country_point
|
||||||
WHERE geometry && bbox AND "rank" <= zoom_level AND name <> ''
|
WHERE geometry && bbox AND "rank" <= zoom_level AND name <> ''
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT
|
SELECT
|
||||||
osm_id, geometry, name, COALESCE(NULLIF(name_en, ''), name) AS name_en,
|
osm_id, geometry, name, COALESCE(NULLIF(name_en, ''), name) AS name_en,
|
||||||
'state' AS class, 'state' AS subclass, "rank", NULL::int AS capital
|
'state' AS class, "rank", NULL::int AS capital
|
||||||
FROM osm_state_point
|
FROM osm_state_point
|
||||||
WHERE geometry && bbox AND
|
WHERE geometry && bbox AND
|
||||||
name <> '' AND
|
name <> '' AND
|
||||||
|
@ -34,7 +34,7 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text, class t
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT
|
SELECT
|
||||||
osm_id, geometry, name, name_en,
|
osm_id, geometry, name, name_en,
|
||||||
place_class(place::text) AS class, place::text AS subclass, "rank", capital
|
place::text AS class, "rank", capital
|
||||||
FROM layer_city(bbox, zoom_level, pixel_width)
|
FROM layer_city(bbox, zoom_level, pixel_width)
|
||||||
ORDER BY "rank" ASC
|
ORDER BY "rank" ASC
|
||||||
$$ LANGUAGE SQL IMMUTABLE;
|
$$ LANGUAGE SQL IMMUTABLE;
|
||||||
|
|
|
@ -16,23 +16,12 @@ layer:
|
||||||
values: [2, 4]
|
values: [2, 4]
|
||||||
class: |
|
class: |
|
||||||
description: |
|
description: |
|
||||||
Distinguish between continents, countries, states and
|
|
||||||
places like settlements or smaller entities.
|
|
||||||
Use this to separately style the different places and build
|
|
||||||
a text hierarchy according to their importance.
|
|
||||||
than cities).
|
|
||||||
values:
|
|
||||||
- continent
|
|
||||||
- country
|
|
||||||
- state
|
|
||||||
- settlement
|
|
||||||
- subregion
|
|
||||||
- other
|
|
||||||
subclass:
|
|
||||||
description: |
|
|
||||||
Use **subclass** to do more precise styling.
|
|
||||||
Original value of the
|
Original value of the
|
||||||
[`place`](http://wiki.openstreetmap.org/wiki/Key:place) tag.
|
[`place`](http://wiki.openstreetmap.org/wiki/Key:place) tag.
|
||||||
|
Distinguish between continents, countries, states and
|
||||||
|
places like settlements or smaller entities.
|
||||||
|
Use **class** to separately style the different places and build
|
||||||
|
a text hierarchy according to their importance.
|
||||||
values:
|
values:
|
||||||
- continent
|
- continent
|
||||||
- country
|
- country
|
||||||
|
@ -63,10 +52,10 @@ layer:
|
||||||
buffer_size: 128
|
buffer_size: 128
|
||||||
datasource:
|
datasource:
|
||||||
geometry_field: geometry
|
geometry_field: geometry
|
||||||
query: (SELECT geometry, name, name_en, class, subclass, rank, capital FROM layer_place(!bbox!, z(!scale_denominator!), !pixel_width!)) AS t
|
query: (SELECT geometry, name, name_en, class, rank, capital FROM layer_place(!bbox!, z(!scale_denominator!), !pixel_width!)) AS t
|
||||||
schema:
|
schema:
|
||||||
- ./types.sql
|
- ./types.sql
|
||||||
- ./class.sql
|
- ./capital.sql
|
||||||
- ./city.sql
|
- ./city.sql
|
||||||
- ./merge_country_rank.sql
|
- ./merge_country_rank.sql
|
||||||
- ./merge_city_rank.sql
|
- ./merge_city_rank.sql
|
||||||
|
|
Ładowanie…
Reference in New Issue