Show more province boundaries on z6

pull/60/head
Lukas Martinelli 2016-11-30 16:56:26 +00:00
rodzic e50979b45c
commit 1f27b72a1a
1 zmienionych plików z 20 dodań i 5 usunięć

Wyświetl plik

@ -56,6 +56,18 @@ CREATE OR REPLACE VIEW boundary_z5 AS (
WHERE scalerank <= 7 AND featurecla = 'Adm-1 boundary'
);
-- etldoc: ne_10m_admin_0_boundary_lines_land -> boundary_z6
-- etldoc: ne_10m_admin_1_states_provinces_lines_shp -> boundary_z6
CREATE OR REPLACE VIEW boundary_z6 AS (
SELECT geom, 2 AS admin_level
FROM ne_10m_admin_0_boundary_lines_land
UNION ALL
SELECT geom, 4 AS admin_level
FROM ne_10m_admin_1_states_provinces_lines_shp
WHERE scalerank <= 9 AND featurecla = 'Adm-1 boundary'
);
-- etldoc: ne_10m_admin_0_boundary_lines_land -> boundary_z7
-- etldoc: ne_10m_admin_1_states_provinces_lines_shp -> boundary_z7
CREATE OR REPLACE VIEW boundary_z7 AS (
@ -103,7 +115,7 @@ CREATE OR REPLACE VIEW boundary_z12 AS (
);
-- etldoc: layer_boundary[shape=record fillcolor=lightpink, style="rounded,filled",
-- etldoc: label="<sql> layer_boundary |<z0> z0 |<z1_2> z1_2 | <z3> z3 | <z4> z4 |<z5_6> z5_6 | <z7> z7 | <z8> z8 | <z9> z9 |<z10> z10 |<z11> z11 |<z12> z12|<z13_> z13_ " ]
-- etldoc: label="<sql> layer_boundary |<z0> z0 |<z1_2> z1_2 | <z3> z3 | <z4> z4 | <z5> z5 || <z6> z6 || <z7> z7 | <z8> z8 | <z9> z9 |<z10> z10 |<z11> z11 |<z12> z12|<z13> z13+"]
CREATE OR REPLACE FUNCTION layer_boundary (bbox geometry, zoom_level int)
RETURNS TABLE(geometry geometry, admin_level int) AS $$
@ -120,8 +132,11 @@ RETURNS TABLE(geometry geometry, admin_level int) AS $$
-- etldoc: boundary_z4 -> layer_boundary:z4
SELECT * FROM boundary_z4 WHERE geom && bbox AND zoom_level = 4
UNION ALL
-- etldoc: boundary_z5 -> layer_boundary:z5_6
SELECT * FROM boundary_z5 WHERE geom && bbox AND zoom_level BETWEEN 5 AND 6
-- etldoc: boundary_z5 -> layer_boundary:z5
SELECT * FROM boundary_z5 WHERE geom && bbox AND zoom_level = 5
UNION ALL
-- etldoc: boundary_z6 -> layer_boundary:z6
SELECT * FROM boundary_z6 WHERE geom && bbox AND zoom_level = 6
UNION ALL
-- etldoc: boundary_z7 -> layer_boundary:z7
SELECT * FROM boundary_z7 WHERE geom && bbox AND zoom_level = 7
@ -141,7 +156,7 @@ RETURNS TABLE(geometry geometry, admin_level int) AS $$
-- etldoc: boundary_z12 -> layer_boundary:z12
SELECT * FROM boundary_z12 WHERE geom && bbox AND zoom_level = 12
UNION ALL
-- etldoc: boundary_z12 -> layer_boundary:z13_
-- etldoc: boundary_z12 -> layer_boundary:z13
SELECT * FROM boundary_z12 WHERE geom && bbox AND zoom_level >= 13
) AS zoom_levels;
$$ LANGUAGE SQL IMMUTABLE;