kopia lustrzana https://github.com/openmaptiles/openmaptiles
Show islands #68
rodzic
e7665db266
commit
01db9a4e63
|
@ -0,0 +1,5 @@
|
|||
-- etldoc: osm_island_polygon -> osm_island_polygon
|
||||
UPDATE osm_island_polygon SET geometry=topoint(geometry)
|
||||
WHERE ST_GeometryType(geometry) <> 'ST_Point';
|
||||
|
||||
ANALYZE osm_island_polygon;
|
|
@ -0,0 +1,9 @@
|
|||
CREATE OR REPLACE FUNCTION island_rank(area REAL) RETURNS INT AS $$
|
||||
SELECT CASE
|
||||
WHEN area < 10000000 THEN 6
|
||||
WHEN area BETWEEN 1000000 AND 15000000 THEN 5
|
||||
WHEN area BETWEEN 15000000 AND 40000000 THEN 4
|
||||
WHEN area > 40000000 THEN 3
|
||||
ELSE 7
|
||||
END;
|
||||
$$ LANGUAGE SQL IMMUTABLE STRICT;
|
|
@ -5,6 +5,8 @@
|
|||
-- 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)
|
||||
|
@ -17,7 +19,7 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text, class t
|
|||
UNION ALL
|
||||
SELECT
|
||||
osm_id, geometry, name, COALESCE(NULLIF(name_en, ''), name) AS name_en,
|
||||
'country' AS class,"rank", NULL::int AS capital
|
||||
'country' AS class, "rank", NULL::int AS capital
|
||||
FROM osm_country_point
|
||||
WHERE geometry && bbox AND "rank" <= zoom_level AND name <> ''
|
||||
UNION ALL
|
||||
|
@ -32,6 +34,22 @@ 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
|
||||
SELECT
|
||||
osm_id, geometry, name, COALESCE(NULLIF(name_en, ''), name) AS name_en,
|
||||
'island' AS class, 7 AS "rank", NULL::int AS capital
|
||||
FROM osm_island_point
|
||||
WHERE zoom_level BETWEEN 12 AND 14
|
||||
AND geometry && bbox
|
||||
UNION ALL
|
||||
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
|
||||
FROM osm_island_polygon
|
||||
WHERE geometry && bbox AND
|
||||
((zoom_level = 8 AND island_rank(area) <= 3)
|
||||
OR (zoom_level = 9 AND island_rank(area) <= 4)
|
||||
OR (zoom_level >= 10))
|
||||
UNION ALL
|
||||
SELECT
|
||||
osm_id, geometry, name, name_en,
|
||||
place::text AS class, "rank", capital
|
||||
|
|
|
@ -88,6 +88,34 @@ tables:
|
|||
place:
|
||||
- country
|
||||
|
||||
# etldoc: imposm3 -> osm_island_polygon
|
||||
island_polygon:
|
||||
type: polygon
|
||||
fields:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
type: geometry
|
||||
- name: area
|
||||
type: pseudoarea
|
||||
- *name
|
||||
- *name_en
|
||||
- *name_de
|
||||
- *name_fr
|
||||
- *name_es
|
||||
- *name_pt
|
||||
- *name_ru
|
||||
- *name_zh
|
||||
- *name_ar
|
||||
- *name_ja
|
||||
- *rank
|
||||
filters:
|
||||
exclude_tags:
|
||||
- [ "name", "__nil__" ]
|
||||
mapping:
|
||||
place:
|
||||
- island
|
||||
|
||||
# etldoc: imposm3 -> osm_island_point
|
||||
island_point:
|
||||
type: point
|
||||
|
|
|
@ -57,6 +57,8 @@ schema:
|
|||
- ./types.sql
|
||||
- ./capital.sql
|
||||
- ./city.sql
|
||||
- ./island_polygon_update.sql
|
||||
- ./island_rank.sql
|
||||
- ./merge_country_rank.sql
|
||||
- ./merge_city_rank.sql
|
||||
- ./merge_state_rank.sql
|
||||
|
|
Ładowanie…
Reference in New Issue