openmaptiles/layers/water_name/layer.sql

47 wiersze
1.9 KiB
MySQL
Czysty Zwykły widok Historia

2016-11-10 13:28:49 +00:00
2016-11-29 19:13:38 +00:00
-- etldoc: layer_water_name[shape=record fillcolor=lightpink, style="rounded,filled",
-- etldoc: label="layer_water_name | <z0_8> z0_8 | <z9_13> z9_13 | <z14_> z14+" ] ;
2016-11-10 13:28:49 +00:00
2016-10-28 14:11:26 +00:00
CREATE OR REPLACE FUNCTION layer_water_name(bbox geometry, zoom_level integer)
RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text, name_de text, tags hstore, class text) AS $$
2016-11-10 13:28:49 +00:00
-- etldoc: osm_water_lakeline -> layer_water_name:z9_13
2016-12-01 10:11:03 +00:00
-- etldoc: osm_water_lakeline -> layer_water_name:z14_
SELECT osm_id, geometry, name,
COALESCE(NULLIF(name_en, ''), name) AS name_en,
COALESCE(NULLIF(name_de, ''), name, name_en) AS name_de,
tags,
'lake'::text AS class
2016-10-28 14:11:26 +00:00
FROM osm_water_lakeline
WHERE geometry && bbox
2016-10-29 13:52:05 +00:00
AND ((zoom_level BETWEEN 9 AND 13 AND LineLabel(zoom_level, NULLIF(name, ''), geometry))
2016-10-28 14:11:26 +00:00
OR (zoom_level >= 14))
2016-11-29 19:13:38 +00:00
-- etldoc: osm_water_point -> layer_water_name:z9_13
2017-01-16 15:40:39 +00:00
-- etldoc: osm_water_point -> layer_water_name:z14_
2016-11-29 19:13:38 +00:00
UNION ALL
SELECT osm_id, geometry, name,
COALESCE(NULLIF(name_en, ''), name) AS name_en,
COALESCE(NULLIF(name_de, ''), name, name_en) AS name_de,
tags,
'lake'::text AS class
2016-11-29 19:13:38 +00:00
FROM osm_water_point
WHERE geometry && bbox AND (
(zoom_level BETWEEN 9 AND 13 AND area > 70000*2^(20-zoom_level))
OR (zoom_level >= 14)
2017-01-16 15:00:45 +00:00
)
-- etldoc: osm_marine_point -> layer_water_name:z0_8
-- etldoc: osm_marine_point -> layer_water_name:z9_13
-- etldoc: osm_marine_point -> layer_water_name:z14_
2017-01-16 15:00:45 +00:00
UNION ALL
SELECT osm_id, geometry, name,
COALESCE(NULLIF(name_en, ''), name) AS name_en,
COALESCE(NULLIF(name_de, ''), name, name_en) AS name_de,
tags,
place::text AS class
2017-01-16 15:00:45 +00:00
FROM osm_marine_point
WHERE geometry && bbox AND (
2017-01-16 15:40:39 +00:00
place = 'ocean'
2017-01-18 09:19:39 +00:00
OR (zoom_level >= 1 AND zoom_level <= "rank" AND "rank" IS NOT NULL)
2017-01-16 15:40:39 +00:00
OR (zoom_level >= 8)
2016-11-29 19:13:38 +00:00
);
2016-10-28 14:11:26 +00:00
$$ LANGUAGE SQL IMMUTABLE;