Add landcover layer
This commit is contained in:
parent
8bc57e13e7
commit
ade28316bd
57
layers/landcover/landcover.sql
Normal file
57
layers/landcover/landcover.sql
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
CREATE OR REPLACE VIEW landcover_z8 AS (
|
||||||
|
SELECT osm_id, geometry, landuse, "natural", wetland FROM osm_landcover_polygon
|
||||||
|
WHERE ST_Area(geometry) > 15000000
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE OR REPLACE VIEW landcover_z9 AS (
|
||||||
|
SELECT osm_id, geometry, landuse, "natural", wetland FROM osm_landcover_polygon
|
||||||
|
WHERE ST_Area(geometry) > 4200000
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE OR REPLACE VIEW landcover_z10 AS (
|
||||||
|
SELECT osm_id, geometry, landuse, "natural", wetland FROM osm_landcover_polygon
|
||||||
|
WHERE ST_Area(geometry) > 1200000
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE OR REPLACE VIEW landcover_z11 AS (
|
||||||
|
SELECT osm_id, geometry, landuse, "natural", wetland FROM osm_landcover_polygon WHERE ST_Area(geometry) > 480000
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE OR REPLACE VIEW landcover_z12 AS (
|
||||||
|
SELECT osm_id, geometry, landuse, "natural", wetland FROM osm_landcover_polygon WHERE ST_Area(geometry) > 240000
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE OR REPLACE VIEW landcover_z13 AS (
|
||||||
|
SELECT osm_id, geometry, landuse, "natural", wetland FROM osm_landcover_polygon WHERE ST_Area(geometry) > 60000
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE OR REPLACE VIEW landcover_z14 AS (
|
||||||
|
SELECT osm_id, geometry, landuse, "natural", wetland FROM osm_landcover_polygon
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION layer_landcover(bbox geometry, zoom_level int)
|
||||||
|
RETURNS TABLE(osm_id bigint, geom geometry, landuse text, "natural" text, wetland text) AS $$
|
||||||
|
SELECT osm_id, geometry, landuse, "natural", wetland FROM (
|
||||||
|
SELECT osm_id, ST_Simplify(geometry, 300) AS geometry, landuse, "natural", wetland
|
||||||
|
FROM landcover_z8 WHERE zoom_level = 8 AND geometry && bbox
|
||||||
|
UNION ALL
|
||||||
|
SELECT osm_id, ST_Simplify(geometry, 200) AS geometry, landuse, "natural", wetland
|
||||||
|
FROM landcover_z9 WHERE zoom_level = 9 AND geometry && bbox
|
||||||
|
UNION ALL
|
||||||
|
SELECT osm_id, ST_Simplify(geometry, 120) AS geometry, landuse, "natural", wetland
|
||||||
|
FROM landcover_z10 WHERE zoom_level = 10 AND geometry && bbox
|
||||||
|
UNION ALL
|
||||||
|
SELECT osm_id, ST_Simplify(geometry, 80) AS geometry, landuse, "natural", wetland
|
||||||
|
FROM landcover_z11 WHERE zoom_level = 11 AND geometry && bbox
|
||||||
|
UNION ALL
|
||||||
|
SELECT osm_id, ST_Simplify(geometry, 50) AS geometry, landuse, "natural", wetland
|
||||||
|
FROM landcover_z12 WHERE zoom_level = 12 AND geometry && bbox
|
||||||
|
UNION ALL
|
||||||
|
SELECT osm_id, ST_Simplify(geometry, 10) AS geometry, landuse, "natural", wetland
|
||||||
|
FROM landcover_z13 WHERE zoom_level = 13 AND geometry && bbox
|
||||||
|
UNION ALL
|
||||||
|
SELECT osm_id, geometry, landuse, "natural", wetland
|
||||||
|
FROM landcover_z14 WHERE zoom_level >= 14 AND geometry && bbox
|
||||||
|
) AS zoom_levels;
|
||||||
|
$$ LANGUAGE SQL IMMUTABLE;
|
||||||
|
|
||||||
11
layers/landcover/landcover.yaml
Normal file
11
layers/landcover/landcover.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
layer:
|
||||||
|
id: "landcover"
|
||||||
|
description: Landcover is used to describe the physical material at the surface of the earth. Land covers include grass, asphalt, trees, bare ground etc. Tagging of landcover is often only implied by other tags at present, for example a park may be assumed to be covered in grass, but in some places this may in fact be trees or sand or some other cover. The following keys imply or specifically indicate landcover properties.
|
||||||
|
buffer_size: 4
|
||||||
|
datasource:
|
||||||
|
query: (SELECT * FROM layer_landcover(!bbox!, z(!scale_denominator!))) AS t
|
||||||
|
schema:
|
||||||
|
- ./landcover.sql
|
||||||
|
datasources:
|
||||||
|
- type: imposm3
|
||||||
|
mapping_file: ./mapping.yaml
|
||||||
68
layers/landcover/mapping.yaml
Normal file
68
layers/landcover/mapping.yaml
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
generalized_tables:
|
||||||
|
landcover_polygon_gen0:
|
||||||
|
source: landcover_polygon_gen1
|
||||||
|
sql_filter: area>500000.000000
|
||||||
|
tolerance: 200.0
|
||||||
|
landcover_polygon_gen1:
|
||||||
|
source: landcover_polygon
|
||||||
|
sql_filter: area>50000.000000
|
||||||
|
tolerance: 50.0
|
||||||
|
tables:
|
||||||
|
landcover_polygon:
|
||||||
|
fields:
|
||||||
|
- name: osm_id
|
||||||
|
type: id
|
||||||
|
- name: geometry
|
||||||
|
type: validated_geometry
|
||||||
|
- name: landuse
|
||||||
|
key: landuse
|
||||||
|
type: string
|
||||||
|
- name: natural
|
||||||
|
key: natural
|
||||||
|
type: string
|
||||||
|
- name: wetland
|
||||||
|
key: wetland
|
||||||
|
type: string
|
||||||
|
- name: area
|
||||||
|
type: pseudoarea
|
||||||
|
mapping:
|
||||||
|
landuse:
|
||||||
|
- allotments
|
||||||
|
- farm
|
||||||
|
- farmland
|
||||||
|
- orchard
|
||||||
|
- greenhouse_horticulture
|
||||||
|
- plant_nursery
|
||||||
|
- vineyard
|
||||||
|
- grass
|
||||||
|
- grassland
|
||||||
|
- meadow
|
||||||
|
- park
|
||||||
|
- village_green
|
||||||
|
- recreation_ground
|
||||||
|
- forest
|
||||||
|
- beach
|
||||||
|
- greenfield
|
||||||
|
natural:
|
||||||
|
- wetland
|
||||||
|
- gravel
|
||||||
|
- sand
|
||||||
|
- wood
|
||||||
|
- scrub
|
||||||
|
- mud
|
||||||
|
- beach
|
||||||
|
- rock
|
||||||
|
- bare_rock
|
||||||
|
- scree
|
||||||
|
- grassland
|
||||||
|
- heath
|
||||||
|
- fell
|
||||||
|
wetland:
|
||||||
|
- saltmarsh
|
||||||
|
- reedbed
|
||||||
|
- bog
|
||||||
|
- marsh
|
||||||
|
- mangrove
|
||||||
|
- swamp
|
||||||
|
- tidalflat
|
||||||
|
type: polygon
|
||||||
Loading…
x
Reference in New Issue
Block a user