kopia lustrzana https://github.com/openmaptiles/openmaptiles
Add national parks
rodzic
a3455407e8
commit
030e1e3204
layers/landuse
|
@ -1,5 +1,6 @@
|
|||
CREATE OR REPLACE FUNCTION landuse_class(landuse TEXT, amenity TEXT) RETURNS TEXT AS $$
|
||||
CREATE OR REPLACE FUNCTION landuse_class(landuse TEXT, amenity TEXT, leisure TEXT, boundary TEXT) RETURNS TEXT AS $$
|
||||
SELECT CASE
|
||||
WHEN leisure = 'nature_reserve' OR boundary='national_park' THEN 'park'
|
||||
WHEN amenity IN ('school', 'university', 'kindergarten', 'college', 'library') THEN 'school'
|
||||
WHEN landuse IN('hospital', 'railway', 'cemetery', 'military', 'residential') THEN landuse
|
||||
ELSE NULL
|
||||
|
@ -7,50 +8,55 @@ CREATE OR REPLACE FUNCTION landuse_class(landuse TEXT, amenity TEXT) RETURNS TEX
|
|||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
|
||||
CREATE OR REPLACE VIEW landuse_z4 AS (
|
||||
SELECT NULL::bigint AS osm_id, geom AS geometry, 'residential' AS landuse, NULL::text AS amenity, scalerank
|
||||
SELECT NULL::bigint AS osm_id, geom AS geometry, 'residential' AS landuse, NULL::text AS amenity, NULL::text AS leisure, NULL::text AS boundary, scalerank
|
||||
FROM ne_50m_urban_areas
|
||||
WHERE scalerank <= 2
|
||||
);
|
||||
|
||||
CREATE OR REPLACE VIEW landuse_z5 AS (
|
||||
SELECT NULL::bigint AS osm_id, geom AS geometry, 'residential' AS landuse, NULL::text AS amenity, scalerank
|
||||
SELECT NULL::bigint AS osm_id, geom AS geometry, 'residential' AS landuse, NULL::text AS amenity, NULL::text AS leisure, NULL::text AS boundary, scalerank
|
||||
FROM ne_50m_urban_areas
|
||||
);
|
||||
|
||||
CREATE OR REPLACE VIEW landuse_z6 AS (
|
||||
SELECT NULL::bigint AS osm_id, geom AS geometry, 'residential' AS landuse, NULL::text AS amenity, scalerank
|
||||
SELECT NULL::bigint AS osm_id, geom AS geometry, 'residential' AS landuse, NULL::text AS amenity, NULL::text AS leisure, NULL::text AS boundary, scalerank
|
||||
FROM ne_10m_urban_areas
|
||||
);
|
||||
|
||||
CREATE OR REPLACE VIEW landuse_z8 AS (
|
||||
SELECT osm_id, geometry, landuse, amenity, leisure, boundary, NULL::int as scalerank FROM osm_landuse_polygon_gen5
|
||||
);
|
||||
|
||||
CREATE OR REPLACE VIEW landuse_z9 AS (
|
||||
SELECT osm_id, geometry, landuse, amenity, leisure, boundary, NULL::int as scalerank FROM osm_landuse_polygon_gen4
|
||||
);
|
||||
|
||||
CREATE OR REPLACE VIEW landuse_z10 AS (
|
||||
SELECT osm_id, geometry, landuse, amenity, NULL::int as scalerank FROM osm_landuse_polygon_gen2
|
||||
WHERE ST_Area(geometry) > 1200000
|
||||
SELECT osm_id, geometry, landuse, amenity, leisure, boundary, NULL::int as scalerank FROM osm_landuse_polygon_gen3
|
||||
);
|
||||
|
||||
CREATE OR REPLACE VIEW landuse_z11 AS (
|
||||
SELECT osm_id, geometry, landuse, amenity, NULL::int as scalerank FROM osm_landuse_polygon_gen2
|
||||
WHERE ST_Area(geometry) > 480000
|
||||
SELECT osm_id, geometry, landuse, amenity, leisure, boundary, NULL::int as scalerank FROM osm_landuse_polygon_gen2
|
||||
);
|
||||
|
||||
CREATE OR REPLACE VIEW landuse_z12 AS (
|
||||
SELECT osm_id, geometry, landuse, amenity, NULL::int as scalerank FROM osm_landuse_polygon_gen1
|
||||
WHERE ST_Area(geometry) > 240000
|
||||
SELECT osm_id, geometry, landuse, amenity, leisure, boundary, NULL::int as scalerank FROM osm_landuse_polygon_gen1
|
||||
);
|
||||
|
||||
CREATE OR REPLACE VIEW landuse_z13 AS (
|
||||
SELECT osm_id, geometry, landuse, amenity, NULL::int as scalerank FROM osm_landuse_polygon
|
||||
SELECT osm_id, geometry, landuse, amenity, leisure, boundary, NULL::int as scalerank FROM osm_landuse_polygon
|
||||
WHERE ST_Area(geometry) > 60000
|
||||
);
|
||||
|
||||
CREATE OR REPLACE VIEW landuse_z14 AS (
|
||||
SELECT osm_id, geometry, landuse, amenity, NULL::int as scalerank FROM osm_landuse_polygon
|
||||
SELECT osm_id, geometry, landuse, amenity, leisure, boundary, NULL::int as scalerank FROM osm_landuse_polygon
|
||||
);
|
||||
|
||||
CREATE OR REPLACE FUNCTION layer_landuse(bbox geometry, zoom_level int)
|
||||
RETURNS TABLE(osm_id bigint, geometry geometry, class text, subclass text) AS $$
|
||||
SELECT osm_id, geometry,
|
||||
landuse_class(landuse, amenity) AS class,
|
||||
COALESCE(NULLIF(landuse, ''), NULLIF(amenity, '')) AS subclass
|
||||
landuse_class(landuse, amenity, leisure, boundary) AS class,
|
||||
COALESCE(NULLIF(landuse, ''), NULLIF(amenity, ''), NULLIF(leisure, ''), NULLIF(boundary, '')) AS subclass
|
||||
FROM (
|
||||
SELECT * FROM landuse_z4
|
||||
WHERE zoom_level = 4
|
||||
|
@ -61,6 +67,10 @@ RETURNS TABLE(osm_id bigint, geometry geometry, class text, subclass text) AS $$
|
|||
SELECT * FROM landuse_z6
|
||||
WHERE zoom_level BETWEEN 6 AND 10 AND scalerank-1 <= zoom_level
|
||||
UNION ALL
|
||||
SELECT * FROM landuse_z8 WHERE zoom_level = 8
|
||||
UNION ALL
|
||||
SELECT * FROM landuse_z9 WHERE zoom_level = 9
|
||||
UNION ALL
|
||||
SELECT * FROM landuse_z10 WHERE zoom_level = 10
|
||||
UNION ALL
|
||||
SELECT * FROM landuse_z11 WHERE zoom_level = 11
|
||||
|
|
|
@ -1,11 +1,23 @@
|
|||
generalized_tables:
|
||||
landuse_polygon_gen5:
|
||||
source: landuse_polygon_gen4
|
||||
sql_filter: area>15000000
|
||||
tolerance: 300.0
|
||||
landuse_polygon_gen4:
|
||||
source: landuse_polygon_gen3
|
||||
sql_filter: area>4200000
|
||||
tolerance: 200.0
|
||||
landuse_polygon_gen3:
|
||||
source: landuse_polygon_gen2
|
||||
sql_filter: area>1200000
|
||||
tolerance: 120.0
|
||||
landuse_polygon_gen2:
|
||||
source: landuse_polygon_gen1
|
||||
sql_filter: area>500000.000000
|
||||
tolerance: 120.0
|
||||
sql_filter: area>480000
|
||||
tolerance: 80.0
|
||||
landuse_polygon_gen1:
|
||||
source: landuse_polygon
|
||||
sql_filter: area>50000.000000
|
||||
sql_filter: area>240000
|
||||
tolerance: 50.0
|
||||
tables:
|
||||
landuse_polygon:
|
||||
|
@ -21,6 +33,12 @@ tables:
|
|||
- name: amenity
|
||||
key: amenity
|
||||
type: string
|
||||
- name: leisure
|
||||
key: leisure
|
||||
type: string
|
||||
- name: boundary
|
||||
key: boundary
|
||||
type: string
|
||||
- name: area
|
||||
type: pseudoarea
|
||||
mapping:
|
||||
|
@ -35,3 +53,7 @@ tables:
|
|||
- railway
|
||||
- cemetery
|
||||
- military
|
||||
leisure:
|
||||
- nature_reserve
|
||||
boundary:
|
||||
- national_park
|
||||
|
|
Ładowanie…
Reference in New Issue