kopia lustrzana https://github.com/openmaptiles/openmaptiles
`place` etldoc enhancement
rodzic
f5ac3def5e
commit
e406537025
|
@ -1,6 +1,6 @@
|
|||
|
||||
-- etldoc: layer_city[shape=record fillcolor=lightpink, style="rounded,filled",
|
||||
-- etldoc: label="layer_city | <z2_14> z2-z14" ] ;
|
||||
-- etldoc: label="layer_city | <z2_14> z2-z14+" ] ;
|
||||
|
||||
-- etldoc: osm_city_point -> layer_city:z2_14
|
||||
CREATE OR REPLACE FUNCTION layer_city(bbox geometry, zoom_level int, pixel_width numeric)
|
||||
|
|
|
@ -1,28 +1,35 @@
|
|||
|
||||
-- etldoc: layer_place[shape=record fillcolor=lightpink, style="rounded,filled",
|
||||
-- etldoc: label="layer_place | <zall> z0-z14_ " ] ;
|
||||
-- etldoc: label="layer_place | <z0_3> z0-3|<z4_7> z4-7|<z8_11> z8-11| <z12_14> z12-z14+" ] ;
|
||||
|
||||
-- etldoc: osm_continent_point -> layer_place
|
||||
-- etldoc: osm_country_point -> layer_place
|
||||
-- etldoc: osm_state_point -> layer_place
|
||||
-- etldoc: osm_island_point -> layer_place
|
||||
-- etldoc: osm_island_polygon -> layer_place
|
||||
-- etldoc: layer_city -> layer_place
|
||||
|
||||
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, "rank" int, capital INT) AS $$
|
||||
|
||||
-- etldoc: osm_continent_point -> layer_place:z0_3
|
||||
SELECT
|
||||
osm_id, geometry, name, name_en,
|
||||
'continent' AS class, 1 AS "rank", NULL::int AS capital
|
||||
FROM osm_continent_point
|
||||
WHERE geometry && bbox AND zoom_level < 4
|
||||
UNION ALL
|
||||
|
||||
|
||||
-- etldoc: osm_country_point -> layer_place:z0_3
|
||||
-- etldoc: osm_country_point -> layer_place:z4_7
|
||||
-- etldoc: osm_country_point -> layer_place:z8_11
|
||||
-- etldoc: osm_country_point -> layer_place:z12_14
|
||||
SELECT
|
||||
osm_id, geometry, name, COALESCE(NULLIF(name_en, ''), name) AS name_en,
|
||||
'country' AS class, "rank", NULL::int AS capital
|
||||
FROM osm_country_point
|
||||
WHERE geometry && bbox AND "rank" <= zoom_level AND name <> ''
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_state_point -> layer_place:z0_3
|
||||
-- etldoc: osm_state_point -> layer_place:z4_7
|
||||
-- etldoc: osm_state_point -> layer_place:z8_11
|
||||
-- etldoc: osm_state_point -> layer_place:z12_14
|
||||
SELECT
|
||||
osm_id, geometry, name, COALESCE(NULLIF(name_en, ''), name) AS name_en,
|
||||
'state' AS class, "rank", NULL::int AS capital
|
||||
|
@ -34,6 +41,8 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text, class t
|
|||
is_in_country IN ('United Kingdom', 'USA', 'Россия', 'Brasil', 'China', 'India') OR
|
||||
is_in_country_code IN ('AU', 'CN', 'IN', 'BR', 'US'))
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_island_point -> layer_place:z12_14
|
||||
SELECT
|
||||
osm_id, geometry, name, COALESCE(NULLIF(name_en, ''), name) AS name_en,
|
||||
'island' AS class, 7 AS "rank", NULL::int AS capital
|
||||
|
@ -41,6 +50,9 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text, class t
|
|||
WHERE zoom_level BETWEEN 12 AND 14
|
||||
AND geometry && bbox
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_island_polygon -> layer_place:z8_11
|
||||
-- etldoc: osm_island_polygon -> layer_place:z12_14
|
||||
SELECT
|
||||
osm_id, geometry, name, COALESCE(NULLIF(name_en, ''), name) AS name_en,
|
||||
'island' AS class, island_rank(area) AS "rank", NULL::int AS capital
|
||||
|
@ -50,6 +62,11 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text, class t
|
|||
OR (zoom_level = 9 AND island_rank(area) <= 4)
|
||||
OR (zoom_level >= 10))
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: layer_city -> layer_place:z0_3
|
||||
-- etldoc: layer_city -> layer_place:z4_7
|
||||
-- etldoc: layer_city -> layer_place:z8_11
|
||||
-- etldoc: layer_city -> layer_place:z12_14
|
||||
SELECT
|
||||
osm_id, geometry, name, name_en,
|
||||
place::text AS class, "rank", capital
|
||||
|
|
Ładowanie…
Reference in New Issue