Merge branch 'master' into protected_area
@@ -15,12 +15,23 @@ layer:
|
||||
[`aerodrome`](http://wiki.openstreetmap.org/wiki/Proposed_features/Aerodrome)
|
||||
and `aerodrome:type` tags.
|
||||
values:
|
||||
- international
|
||||
- public
|
||||
- regional
|
||||
- military
|
||||
- private
|
||||
- other
|
||||
international:
|
||||
aerodrome: 'international'
|
||||
aerodrome_type: 'international'
|
||||
public:
|
||||
aerodrome: 'public'
|
||||
aerodrome_type: ['%public%', 'civil']
|
||||
regional:
|
||||
aerodrome: 'regional'
|
||||
aerodrome_type: 'regional'
|
||||
military:
|
||||
aerodrome: 'military'
|
||||
aerodrome_type: '%military%'
|
||||
military: 'airfield'
|
||||
private:
|
||||
aerodrome: 'private'
|
||||
aerodrome_type: 'private'
|
||||
other:
|
||||
iata: 3-character code issued by the IATA.
|
||||
icao: 4-letter code issued by the ICAO.
|
||||
ele: Elevation (`ele`) in meters.
|
||||
|
||||
@@ -27,27 +27,7 @@ $$
|
||||
COALESCE(NULLIF(name_de, ''), name, name_en) AS name_de,
|
||||
tags,
|
||||
CASE
|
||||
WHEN aerodrome = 'international'
|
||||
OR aerodrome_type = 'international'
|
||||
THEN 'international'
|
||||
WHEN
|
||||
aerodrome = 'public'
|
||||
OR aerodrome_type LIKE '%public%'
|
||||
OR aerodrome_type = 'civil'
|
||||
THEN 'public'
|
||||
WHEN
|
||||
aerodrome = 'regional'
|
||||
OR aerodrome_type = 'regional'
|
||||
THEN 'regional'
|
||||
WHEN
|
||||
aerodrome = 'military'
|
||||
OR aerodrome_type LIKE '%military%'
|
||||
OR military = 'airfield'
|
||||
THEN 'military'
|
||||
WHEN
|
||||
aerodrome = 'private'
|
||||
OR aerodrome_type = 'private'
|
||||
THEN 'private'
|
||||
%%FIELD_MAPPING: class %%
|
||||
ELSE 'other'
|
||||
END AS class,
|
||||
NULLIF(iata, '') AS iata,
|
||||
@@ -56,5 +36,6 @@ $$
|
||||
round(substring(ele from E'^(-?\\d+)(\\D|$)')::int*3.2808399)::int AS ele_ft
|
||||
FROM osm_aerodrome_label_point
|
||||
WHERE geometry && bbox AND zoom_level >= 10;
|
||||
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE PARALLEL SAFE;
|
||||
|
||||
@@ -3,7 +3,7 @@ tables:
|
||||
# etldoc: imposm3 -> osm_aerodrome_label_point
|
||||
aerodrome_label_point:
|
||||
type: geometry
|
||||
fields:
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
|
||||
@@ -40,4 +40,6 @@ RETURNS TABLE(geometry geometry, class text, ref text) AS $$
|
||||
FROM osm_aeroway_polygon WHERE zoom_level >= 14
|
||||
) AS zoom_levels
|
||||
WHERE geometry && bbox;
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
$$
|
||||
LANGUAGE SQL IMMUTABLE
|
||||
PARALLEL SAFE;
|
||||
|
||||
@@ -50,7 +50,7 @@ tables:
|
||||
# etldoc: imposm3 -> osm_aeroway_polygon
|
||||
aeroway_polygon:
|
||||
type: polygon
|
||||
fields:
|
||||
columns:
|
||||
- *ref
|
||||
- name: osm_id
|
||||
type: id
|
||||
@@ -67,7 +67,7 @@ tables:
|
||||
# etldoc: imposm3 -> osm_aeroway_linestring
|
||||
aeroway_linestring:
|
||||
type: linestring
|
||||
fields:
|
||||
columns:
|
||||
- *ref
|
||||
- name: osm_id
|
||||
type: id
|
||||
|
||||
@@ -1,3 +1,114 @@
|
||||
-- This statement can be deleted after the border importer image stops creating this object as a table
|
||||
DO $$ BEGIN DROP TABLE IF EXISTS osm_border_linestring_gen1 CASCADE; EXCEPTION WHEN wrong_object_type THEN END; $$ language 'plpgsql';
|
||||
-- etldoc: osm_border_linestring -> osm_border_linestring_gen1
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_border_linestring_gen1 CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_border_linestring_gen1 AS (
|
||||
SELECT ST_Simplify(geometry, 10) AS geometry, osm_id, admin_level, dividing_line, disputed, maritime
|
||||
FROM osm_border_linestring
|
||||
WHERE admin_level <= 10
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS osm_border_linestring_gen1_idx ON osm_border_linestring_gen1 USING gist (geometry);
|
||||
|
||||
-- This statement can be deleted after the border importer image stops creating this object as a table
|
||||
DO $$ BEGIN DROP TABLE IF EXISTS osm_border_linestring_gen2 CASCADE; EXCEPTION WHEN wrong_object_type THEN END; $$ language 'plpgsql';
|
||||
-- etldoc: osm_border_linestring -> osm_border_linestring_gen2
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_border_linestring_gen2 CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_border_linestring_gen2 AS (
|
||||
SELECT ST_Simplify(geometry, 20) AS geometry, osm_id, admin_level, dividing_line, disputed, maritime
|
||||
FROM osm_border_linestring
|
||||
WHERE admin_level <= 10
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS osm_border_linestring_gen2_idx ON osm_border_linestring_gen2 USING gist (geometry);
|
||||
|
||||
-- This statement can be deleted after the border importer image stops creating this object as a table
|
||||
DO $$ BEGIN DROP TABLE IF EXISTS osm_border_linestring_gen3 CASCADE; EXCEPTION WHEN wrong_object_type THEN END; $$ language 'plpgsql';
|
||||
-- etldoc: osm_border_linestring -> osm_border_linestring_gen3
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_border_linestring_gen3 CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_border_linestring_gen3 AS (
|
||||
SELECT ST_Simplify(geometry, 40) AS geometry, osm_id, admin_level, dividing_line, disputed, maritime
|
||||
FROM osm_border_linestring
|
||||
WHERE admin_level <= 8
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS osm_border_linestring_gen3_idx ON osm_border_linestring_gen3 USING gist (geometry);
|
||||
|
||||
-- This statement can be deleted after the border importer image stops creating this object as a table
|
||||
DO $$ BEGIN DROP TABLE IF EXISTS osm_border_linestring_gen4 CASCADE; EXCEPTION WHEN wrong_object_type THEN END; $$ language 'plpgsql';
|
||||
-- etldoc: osm_border_linestring -> osm_border_linestring_gen4
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_border_linestring_gen4 CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_border_linestring_gen4 AS (
|
||||
SELECT ST_Simplify(geometry, 80) AS geometry, osm_id, admin_level, dividing_line, disputed, maritime
|
||||
FROM osm_border_linestring
|
||||
WHERE admin_level <= 6
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS osm_border_linestring_gen4_idx ON osm_border_linestring_gen4 USING gist (geometry);
|
||||
|
||||
-- This statement can be deleted after the border importer image stops creating this object as a table
|
||||
DO $$ BEGIN DROP TABLE IF EXISTS osm_border_linestring_gen5 CASCADE; EXCEPTION WHEN wrong_object_type THEN END; $$ language 'plpgsql';
|
||||
-- etldoc: osm_border_linestring -> osm_border_linestring_gen5
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_border_linestring_gen5 CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_border_linestring_gen5 AS (
|
||||
SELECT ST_Simplify(geometry, 160) AS geometry, osm_id, admin_level, dividing_line, disputed, maritime
|
||||
FROM osm_border_linestring
|
||||
WHERE admin_level <= 6
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS osm_border_linestring_gen5_idx ON osm_border_linestring_gen5 USING gist (geometry);
|
||||
|
||||
-- This statement can be deleted after the border importer image stops creating this object as a table
|
||||
DO $$ BEGIN DROP TABLE IF EXISTS osm_border_linestring_gen6 CASCADE; EXCEPTION WHEN wrong_object_type THEN END; $$ language 'plpgsql';
|
||||
-- etldoc: osm_border_linestring -> osm_border_linestring_gen6
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_border_linestring_gen6 CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_border_linestring_gen6 AS (
|
||||
SELECT ST_Simplify(geometry, 300) AS geometry, osm_id, admin_level, dividing_line, disputed, maritime
|
||||
FROM osm_border_linestring
|
||||
WHERE admin_level <= 4
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS osm_border_linestring_gen6_idx ON osm_border_linestring_gen6 USING gist (geometry);
|
||||
|
||||
-- This statement can be deleted after the border importer image stops creating this object as a table
|
||||
DO $$ BEGIN DROP TABLE IF EXISTS osm_border_linestring_gen7 CASCADE; EXCEPTION WHEN wrong_object_type THEN END; $$ language 'plpgsql';
|
||||
-- etldoc: osm_border_linestring -> osm_border_linestring_gen7
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_border_linestring_gen7 CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_border_linestring_gen7 AS (
|
||||
SELECT ST_Simplify(geometry, 600) AS geometry, osm_id, admin_level, dividing_line, disputed, maritime
|
||||
FROM osm_border_linestring
|
||||
WHERE admin_level <= 4
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS osm_border_linestring_gen7_idx ON osm_border_linestring_gen7 USING gist (geometry);
|
||||
|
||||
-- This statement can be deleted after the border importer image stops creating this object as a table
|
||||
DO $$ BEGIN DROP TABLE IF EXISTS osm_border_linestring_gen8 CASCADE; EXCEPTION WHEN wrong_object_type THEN END; $$ language 'plpgsql';
|
||||
-- etldoc: osm_border_linestring -> osm_border_linestring_gen8
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_border_linestring_gen8 CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_border_linestring_gen8 AS (
|
||||
SELECT ST_Simplify(geometry, 1200) AS geometry, osm_id, admin_level, dividing_line, disputed, maritime
|
||||
FROM osm_border_linestring
|
||||
WHERE admin_level <= 4
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS osm_border_linestring_gen8_idx ON osm_border_linestring_gen8 USING gist (geometry);
|
||||
|
||||
-- This statement can be deleted after the border importer image stops creating this object as a table
|
||||
DO $$ BEGIN DROP TABLE IF EXISTS osm_border_linestring_gen9 CASCADE; EXCEPTION WHEN wrong_object_type THEN END; $$ language 'plpgsql';
|
||||
-- etldoc: osm_border_linestring -> osm_border_linestring_gen9
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_border_linestring_gen9 CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_border_linestring_gen9 AS (
|
||||
SELECT ST_Simplify(geometry, 2400) AS geometry, osm_id, admin_level, dividing_line, disputed, maritime
|
||||
FROM osm_border_linestring
|
||||
WHERE admin_level <= 4
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS osm_border_linestring_gen9_idx ON osm_border_linestring_gen9 USING gist (geometry);
|
||||
|
||||
-- This statement can be deleted after the border importer image stops creating this object as a table
|
||||
DO $$ BEGIN DROP TABLE IF EXISTS osm_border_linestring_gen10 CASCADE; EXCEPTION WHEN wrong_object_type THEN END; $$ language 'plpgsql';
|
||||
-- etldoc: osm_border_linestring -> osm_border_linestring_gen10
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_border_linestring_gen10 CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_border_linestring_gen10 AS (
|
||||
SELECT ST_Simplify(geometry, 4800) AS geometry, osm_id, admin_level, dividing_line, disputed, maritime
|
||||
FROM osm_border_linestring
|
||||
WHERE admin_level <= 2
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS osm_border_linestring_gen10_idx ON osm_border_linestring_gen10 USING gist (geometry);
|
||||
|
||||
|
||||
CREATE OR REPLACE FUNCTION edit_name(name VARCHAR) RETURNS TEXT AS $$
|
||||
SELECT CASE
|
||||
WHEN POSITION(' at ' in name) > 0
|
||||
@@ -359,4 +470,6 @@ RETURNS TABLE(geometry geometry, admin_level int, disputed int, disputed_name te
|
||||
-- etldoc: boundary_z13 -> layer_boundary:z13
|
||||
SELECT * FROM boundary_z13 WHERE geometry && bbox AND zoom_level >= 13
|
||||
) AS zoom_levels;
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
$$
|
||||
LANGUAGE SQL IMMUTABLE
|
||||
PARALLEL SAFE;
|
||||
|
||||
|
Before Width: | Height: | Size: 457 KiB After Width: | Height: | Size: 500 KiB |
@@ -76,7 +76,7 @@ tables:
|
||||
# etldoc: imposm3 -> osm_border_disp_relation
|
||||
border_disp_relation:
|
||||
type: relation_member
|
||||
fields:
|
||||
columns:
|
||||
- name: relation_id
|
||||
type: id
|
||||
- name: osm_id
|
||||
|
||||
@@ -60,8 +60,8 @@ CREATE OR REPLACE VIEW osm_all_buildings AS (
|
||||
osm_building_street WHERE role = 'house' AND ST_GeometryType(geometry) = 'ST_Polygon'
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_building_multipolygon -> layer_building:z14_
|
||||
-- Buildings that are inner/outer
|
||||
-- etldoc: osm_building_polygon -> layer_building:z14_
|
||||
-- Buildings that are from multipolygons
|
||||
SELECT osm_id,geometry,
|
||||
COALESCE(nullif(as_numeric(height),-1),nullif(as_numeric(buildingheight),-1)) as height,
|
||||
COALESCE(nullif(as_numeric(min_height),-1),nullif(as_numeric(buildingmin_height),-1)) as min_height,
|
||||
@@ -71,7 +71,9 @@ CREATE OR REPLACE VIEW osm_all_buildings AS (
|
||||
nullif(colour, '') AS colour,
|
||||
FALSE as hide_3d
|
||||
FROM
|
||||
osm_building_polygon obp WHERE EXISTS (SELECT 1 FROM osm_building_multipolygon obm WHERE obp.osm_id = obm.osm_id)
|
||||
osm_building_polygon obp
|
||||
WHERE osm_id < 0
|
||||
|
||||
UNION ALL
|
||||
-- etldoc: osm_building_polygon -> layer_building:z14_
|
||||
-- Standalone buildings
|
||||
@@ -112,7 +114,7 @@ RETURNS TABLE(geometry geometry, osm_id bigint, render_height int, render_min_he
|
||||
WHEN 'sandstone' THEN '#b4a995' -- same as stone
|
||||
WHEN 'clay' THEN '#9d8b75' -- same as mud
|
||||
END) AS colour,
|
||||
CASE WHEN hide_3d THEN TRUE ELSE NULL::boolean END AS hide_3d
|
||||
CASE WHEN hide_3d THEN TRUE END AS hide_3d
|
||||
FROM (
|
||||
-- etldoc: osm_building_polygon_gen1 -> layer_building:z13
|
||||
SELECT
|
||||
@@ -140,6 +142,8 @@ RETURNS TABLE(geometry geometry, osm_id bigint, render_height int, render_min_he
|
||||
zoom_level >= 14 AND geometry && bbox
|
||||
) AS zoom_levels
|
||||
ORDER BY render_height ASC, ST_YMin(geometry) DESC;
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
$$
|
||||
LANGUAGE SQL IMMUTABLE
|
||||
PARALLEL SAFE;
|
||||
|
||||
-- not handled: where a building outline covers building parts
|
||||
|
||||
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 59 KiB |
@@ -8,7 +8,7 @@ generalized_tables:
|
||||
tables:
|
||||
# etldoc: imposm3 -> osm_building_polygon
|
||||
building_polygon:
|
||||
fields:
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
@@ -69,7 +69,7 @@ tables:
|
||||
|
||||
# etldoc: imposm3 -> osm_building_street
|
||||
building_street:
|
||||
fields:
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
@@ -161,7 +161,7 @@ tables:
|
||||
|
||||
# etldoc: imposm3 -> osm_building_associatedstreet
|
||||
building_associatedstreet:
|
||||
fields:
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
@@ -253,7 +253,7 @@ tables:
|
||||
|
||||
# etldoc: imposm3 -> osm_building_relation
|
||||
building_relation:
|
||||
fields:
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
@@ -342,76 +342,3 @@ tables:
|
||||
mapping:
|
||||
type: [building]
|
||||
type: relation_member
|
||||
|
||||
# etldoc: imposm3 -> osm_building_multipolygon
|
||||
building_multipolygon:
|
||||
fields:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
type: validated_geometry
|
||||
- name: area
|
||||
type: area
|
||||
- name: building
|
||||
key: building
|
||||
type: string
|
||||
from_member: true
|
||||
- name: material
|
||||
key: building:material
|
||||
type: string
|
||||
- name: colour
|
||||
key: building:colour
|
||||
type: string
|
||||
- name: buildingpart
|
||||
key: building:part
|
||||
type: string
|
||||
from_member: true
|
||||
- name: buildingheight
|
||||
key: building:height
|
||||
type: string
|
||||
from_member: true
|
||||
- name: height
|
||||
key: height
|
||||
type: string
|
||||
from_member: true
|
||||
- name: buildingmin_height
|
||||
key: building:min_height
|
||||
type: string
|
||||
from_member: true
|
||||
- name: min_height
|
||||
key: min_height
|
||||
type: string
|
||||
from_member: true
|
||||
- name: buildinglevels
|
||||
key: building:levels
|
||||
type: string
|
||||
from_member: true
|
||||
- name: levels
|
||||
key: levels
|
||||
type: string
|
||||
from_member: true
|
||||
- name: buildingmin_level
|
||||
key: building:min_level
|
||||
type: string
|
||||
from_member: true
|
||||
- name: min_level
|
||||
key: min_level
|
||||
type: string
|
||||
from_member: true
|
||||
- name: member
|
||||
type: member_id
|
||||
- name: index
|
||||
type: member_index
|
||||
- name: role
|
||||
type: member_role
|
||||
from_member: true
|
||||
- name: type
|
||||
type: member_type
|
||||
mapping:
|
||||
type: [multipolygon]
|
||||
filters:
|
||||
reject:
|
||||
building: ["no","none","No"]
|
||||
building:part: ["no","none","No"]
|
||||
man_made: ["bridge"]
|
||||
type: relation_member
|
||||
|
||||
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 34 KiB |
@@ -7,4 +7,6 @@ RETURNS TABLE(osm_id bigint, geometry geometry, housenumber text) AS $$
|
||||
-- etldoc: osm_housenumber_point -> layer_housenumber:z14_
|
||||
SELECT osm_id, geometry, housenumber FROM osm_housenumber_point
|
||||
WHERE zoom_level >= 14 AND geometry && bbox;
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE PARALLEL SAFE;
|
||||
|
||||
@@ -4,7 +4,7 @@ tables:
|
||||
# etldoc: imposm3 -> osm_housenumber_point
|
||||
housenumber_point:
|
||||
type: geometry
|
||||
fields:
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
|
||||
@@ -11,18 +11,11 @@
|
||||
|
||||
CREATE OR REPLACE FUNCTION landcover_class(subclass VARCHAR) RETURNS TEXT AS $$
|
||||
SELECT CASE
|
||||
WHEN subclass IN ('farmland', 'farm', 'orchard', 'vineyard', 'plant_nursery') THEN 'farmland'
|
||||
WHEN subclass IN ('glacier', 'ice_shelf') THEN 'ice'
|
||||
WHEN subclass IN ('wood', 'forest') THEN 'wood'
|
||||
WHEN subclass IN ('bare_rock', 'scree') THEN 'rock'
|
||||
WHEN subclass IN ('fell', 'grassland', 'heath', 'scrub', 'tundra', 'grass', 'meadow', 'allotments',
|
||||
'park', 'village_green', 'recreation_ground', 'garden', 'golf_course') THEN 'grass'
|
||||
WHEN subclass IN ('wetland', 'bog', 'swamp', 'wet_meadow', 'marsh', 'reedbed',
|
||||
'saltern', 'tidalflat', 'saltmarsh', 'mangrove') THEN 'wetland'
|
||||
WHEN subclass IN ('beach', 'sand', 'dune') THEN 'sand'
|
||||
ELSE NULL
|
||||
%%FIELD_MAPPING: class %%
|
||||
END;
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE PARALLEL SAFE;
|
||||
|
||||
-- etldoc: ne_110m_glaciated_areas -> landcover_z0
|
||||
CREATE OR REPLACE VIEW landcover_z0 AS (
|
||||
@@ -137,4 +130,6 @@ RETURNS TABLE(osm_id bigint, geometry geometry, class text, subclass text) AS $$
|
||||
SELECT *
|
||||
FROM landcover_z14 WHERE zoom_level >= 14 AND geometry && bbox
|
||||
) AS zoom_levels;
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE PARALLEL SAFE;
|
||||
|
||||
@@ -10,12 +10,20 @@ layer:
|
||||
description: |
|
||||
Use the **class** to assign natural colors for **landcover**.
|
||||
values:
|
||||
- farmland
|
||||
- ice
|
||||
- wood
|
||||
- grass
|
||||
- wetland
|
||||
- sand
|
||||
farmland:
|
||||
subclass: ['farmland', 'farm', 'orchard', 'vineyard', 'plant_nursery']
|
||||
ice:
|
||||
subclass: ['glacier', 'ice_shelf']
|
||||
wood:
|
||||
subclass: ['wood', 'forest']
|
||||
rock:
|
||||
subclass: ['bare_rock', 'scree']
|
||||
grass:
|
||||
subclass: ['fell', 'grassland', 'heath', 'scrub', 'tundra', 'grass', 'meadow', 'allotments', 'park', 'village_green', 'recreation_ground', 'garden', 'golf_course']
|
||||
wetland:
|
||||
subclass: ['wetland', 'bog', 'swamp', 'wet_meadow', 'marsh', 'reedbed', 'saltern', 'tidalflat', 'saltmarsh', 'mangrove']
|
||||
sand:
|
||||
subclass: ['beach', 'sand', 'dune']
|
||||
subclass:
|
||||
description: |
|
||||
Use **subclass** to do more precise styling.
|
||||
|
||||
@@ -46,7 +46,7 @@ generalized_tables:
|
||||
tables:
|
||||
# etldoc: imposm3 -> osm_landcover_polygon
|
||||
landcover_polygon:
|
||||
fields:
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
|
||||
@@ -1,61 +1,61 @@
|
||||
-- etldoc: ne_50m_urban_areas -> landuse_z4
|
||||
CREATE OR REPLACE VIEW landuse_z4 AS (
|
||||
SELECT NULL::bigint AS osm_id, geometry, 'residential'::text AS landuse, NULL::text AS amenity, NULL::text AS leisure, NULL::text AS tourism, NULL::text AS place, NULL::text AS waterway, scalerank
|
||||
SELECT NULL::bigint AS osm_id, geometry, 'residential'::text AS landuse, NULL::text AS amenity, NULL::text AS leisure, NULL::text AS tourism, NULL::text AS place, NULL::text AS waterway
|
||||
FROM ne_50m_urban_areas
|
||||
WHERE scalerank <= 2
|
||||
);
|
||||
|
||||
-- etldoc: ne_50m_urban_areas -> landuse_z5
|
||||
CREATE OR REPLACE VIEW landuse_z5 AS (
|
||||
SELECT NULL::bigint AS osm_id, geometry, 'residential'::text AS landuse, NULL::text AS amenity, NULL::text AS leisure, NULL::text AS tourism, NULL::text AS place, NULL::text AS waterway, scalerank
|
||||
SELECT NULL::bigint AS osm_id, geometry, 'residential'::text AS landuse, NULL::text AS amenity, NULL::text AS leisure, NULL::text AS tourism, NULL::text AS place, NULL::text AS waterway
|
||||
FROM ne_50m_urban_areas
|
||||
);
|
||||
|
||||
-- etldoc: osm_landuse_polygon_gen7 -> landuse_z6
|
||||
CREATE OR REPLACE VIEW landuse_z6 AS (
|
||||
SELECT osm_id, geometry, landuse, amenity, leisure, tourism, place, waterway, NULL::int as scalerank
|
||||
SELECT osm_id, geometry, landuse, amenity, leisure, tourism, place, waterway
|
||||
FROM osm_landuse_polygon_gen7
|
||||
);
|
||||
|
||||
-- etldoc: osm_landuse_polygon_gen6 -> landuse_z8
|
||||
CREATE OR REPLACE VIEW landuse_z8 AS (
|
||||
SELECT osm_id, geometry, landuse, amenity, leisure, tourism, place, waterway, NULL::int as scalerank
|
||||
SELECT osm_id, geometry, landuse, amenity, leisure, tourism, place, waterway
|
||||
FROM osm_landuse_polygon_gen6
|
||||
);
|
||||
|
||||
-- etldoc: osm_landuse_polygon_gen5 -> landuse_z9
|
||||
CREATE OR REPLACE VIEW landuse_z9 AS (
|
||||
SELECT osm_id, geometry, landuse, amenity, leisure, tourism, place, waterway, NULL::int as scalerank
|
||||
SELECT osm_id, geometry, landuse, amenity, leisure, tourism, place, waterway
|
||||
FROM osm_landuse_polygon_gen5
|
||||
);
|
||||
|
||||
-- etldoc: osm_landuse_polygon_gen4 -> landuse_z10
|
||||
CREATE OR REPLACE VIEW landuse_z10 AS (
|
||||
SELECT osm_id, geometry, landuse, amenity, leisure, tourism, place, waterway, NULL::int as scalerank
|
||||
SELECT osm_id, geometry, landuse, amenity, leisure, tourism, place, waterway
|
||||
FROM osm_landuse_polygon_gen4
|
||||
);
|
||||
|
||||
-- etldoc: osm_landuse_polygon_gen3 -> landuse_z11
|
||||
CREATE OR REPLACE VIEW landuse_z11 AS (
|
||||
SELECT osm_id, geometry, landuse, amenity, leisure, tourism, place, waterway, NULL::int as scalerank
|
||||
SELECT osm_id, geometry, landuse, amenity, leisure, tourism, place, waterway
|
||||
FROM osm_landuse_polygon_gen3
|
||||
);
|
||||
|
||||
-- etldoc: osm_landuse_polygon_gen2 -> landuse_z12
|
||||
CREATE OR REPLACE VIEW landuse_z12 AS (
|
||||
SELECT osm_id, geometry, landuse, amenity, leisure, tourism, place, waterway, NULL::int as scalerank
|
||||
SELECT osm_id, geometry, landuse, amenity, leisure, tourism, place, waterway
|
||||
FROM osm_landuse_polygon_gen2
|
||||
);
|
||||
|
||||
-- etldoc: osm_landuse_polygon_gen1 -> landuse_z13
|
||||
CREATE OR REPLACE VIEW landuse_z13 AS (
|
||||
SELECT osm_id, geometry, landuse, amenity, leisure, tourism, place, waterway, NULL::int as scalerank
|
||||
SELECT osm_id, geometry, landuse, amenity, leisure, tourism, place, waterway
|
||||
FROM osm_landuse_polygon_gen1
|
||||
);
|
||||
|
||||
-- etldoc: osm_landuse_polygon -> landuse_z14
|
||||
CREATE OR REPLACE VIEW landuse_z14 AS (
|
||||
SELECT osm_id, geometry, landuse, amenity, leisure, tourism, place, waterway, NULL::int as scalerank
|
||||
SELECT osm_id, geometry, landuse, amenity, leisure, tourism, place, waterway
|
||||
FROM osm_landuse_polygon
|
||||
);
|
||||
|
||||
@@ -108,4 +108,6 @@ RETURNS TABLE(osm_id bigint, geometry geometry, class text) AS $$
|
||||
SELECT * FROM landuse_z14 WHERE zoom_level >= 14
|
||||
) AS zoom_levels
|
||||
WHERE geometry && bbox;
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE PARALLEL SAFE;
|
||||
|
||||
@@ -38,7 +38,7 @@ tables:
|
||||
# etldoc: imposm3 -> osm_landuse_polygon
|
||||
landuse_polygon:
|
||||
type: polygon
|
||||
fields:
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
|
||||
@@ -3,32 +3,32 @@
|
||||
-- etldoc: style="rounded,filled", label="layer_mountain_peak | <z7_> z7+" ] ;
|
||||
|
||||
CREATE OR REPLACE FUNCTION layer_mountain_peak(
|
||||
bbox geometry,
|
||||
zoom_level integer,
|
||||
bbox geometry,
|
||||
zoom_level integer,
|
||||
pixel_width numeric)
|
||||
RETURNS TABLE(
|
||||
osm_id bigint,
|
||||
geometry geometry,
|
||||
name text,
|
||||
name_en text,
|
||||
name_de text,
|
||||
class text,
|
||||
geometry geometry,
|
||||
name text,
|
||||
name_en text,
|
||||
name_de text,
|
||||
class text,
|
||||
tags hstore,
|
||||
ele int,
|
||||
ele_ft int,
|
||||
"rank" int) AS
|
||||
ele int,
|
||||
ele_ft int,
|
||||
"rank" int) AS
|
||||
$$
|
||||
-- etldoc: osm_peak_point -> layer_mountain_peak:z7_
|
||||
SELECT
|
||||
osm_id,
|
||||
geometry,
|
||||
name,
|
||||
name_en,
|
||||
name_de,
|
||||
tags -> 'natural' AS class,
|
||||
SELECT
|
||||
osm_id,
|
||||
geometry,
|
||||
name,
|
||||
name_en,
|
||||
name_de,
|
||||
tags -> 'natural' AS class,
|
||||
tags,
|
||||
ele::int,
|
||||
ele_ft::int,
|
||||
ele::int,
|
||||
ele_ft::int,
|
||||
rank::int FROM (
|
||||
SELECT osm_id, geometry, name,
|
||||
COALESCE(NULLIF(name_en, ''), name) AS name_en,
|
||||
@@ -52,4 +52,6 @@ $$
|
||||
WHERE zoom_level >= 7 AND (rank <= 5 OR zoom_level >= 14)
|
||||
ORDER BY "rank" ASC;
|
||||
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE PARALLEL SAFE;
|
||||
|
||||
@@ -3,7 +3,7 @@ tables:
|
||||
# etldoc: imposm3 -> osm_peak_point
|
||||
peak_point:
|
||||
type: point
|
||||
fields:
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
|
||||
|
Before Width: | Height: | Size: 153 KiB After Width: | Height: | Size: 138 KiB |
@@ -15,37 +15,37 @@ RETURNS TABLE(osm_id bigint, geometry geometry, class text, name text, name_en t
|
||||
NULL::int as rank
|
||||
FROM (
|
||||
-- etldoc: osm_park_polygon_gen8 -> layer_park:z6
|
||||
SELECT osm_id, geometry, name, name_en, name_de, tags, leisure, boundary, protection_title, NULL::int as scalerank
|
||||
SELECT osm_id, geometry, name, name_en, name_de, tags, leisure, boundary, protection_title
|
||||
FROM osm_park_polygon_gen8
|
||||
WHERE zoom_level = 6 AND geometry && bbox
|
||||
UNION ALL
|
||||
-- etldoc: osm_park_polygon_gen7 -> layer_park:z7
|
||||
SELECT osm_id, geometry, name, name_en, name_de, tags, leisure, boundary, protection_title, NULL::int as scalerank
|
||||
SELECT osm_id, geometry, name, name_en, name_de, tags, leisure, boundary, protection_title
|
||||
FROM osm_park_polygon_gen7
|
||||
WHERE zoom_level = 7 AND geometry && bbox
|
||||
UNION ALL
|
||||
-- etldoc: osm_park_polygon_gen6 -> layer_park:z8
|
||||
SELECT osm_id, geometry, name, name_en, name_de, tags, leisure, boundary, protection_title, NULL::int as scalerank
|
||||
SELECT osm_id, geometry, name, name_en, name_de, tags, leisure, boundary, protection_title
|
||||
FROM osm_park_polygon_gen6
|
||||
WHERE zoom_level = 8 AND geometry && bbox
|
||||
UNION ALL
|
||||
-- etldoc: osm_park_polygon_gen5 -> layer_park:z9
|
||||
SELECT osm_id, geometry, name, name_en, name_de, tags, leisure, boundary, protection_title, NULL::int as scalerank
|
||||
SELECT osm_id, geometry, name, name_en, name_de, tags, leisure, boundary, protection_title
|
||||
FROM osm_park_polygon_gen5
|
||||
WHERE zoom_level = 9 AND geometry && bbox
|
||||
UNION ALL
|
||||
-- etldoc: osm_park_polygon_gen4 -> layer_park:z10
|
||||
SELECT osm_id, geometry, name, name_en, name_de, tags, leisure, boundary, protection_title, NULL::int as scalerank
|
||||
SELECT osm_id, geometry, name, name_en, name_de, tags, leisure, boundary, protection_title
|
||||
FROM osm_park_polygon_gen4
|
||||
WHERE zoom_level = 10 AND geometry && bbox
|
||||
UNION ALL
|
||||
-- etldoc: osm_park_polygon_gen3 -> layer_park:z11
|
||||
SELECT osm_id, geometry, name, name_en, name_de, tags, leisure, boundary, protection_title, NULL::int as scalerank
|
||||
SELECT osm_id, geometry, name, name_en, name_de, tags, leisure, boundary, protection_title
|
||||
FROM osm_park_polygon_gen3
|
||||
WHERE zoom_level = 11 AND geometry && bbox
|
||||
UNION ALL
|
||||
-- etldoc: osm_park_polygon_gen2 -> layer_park:z12
|
||||
SELECT osm_id, geometry, name, name_en, name_de, tags, leisure, boundary, protection_title, NULL::int as scalerank
|
||||
SELECT osm_id, geometry, name, name_en, name_de, tags, leisure, boundary, protection_title
|
||||
FROM osm_park_polygon_gen2
|
||||
WHERE zoom_level = 12 AND geometry && bbox
|
||||
UNION ALL
|
||||
@@ -130,4 +130,6 @@ RETURNS TABLE(osm_id bigint, geometry geometry, class text, name text, name_en t
|
||||
WHERE zoom_level >= 14 AND geometry_point && bbox
|
||||
) AS park_point
|
||||
) AS park_all;
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE PARALLEL SAFE;
|
||||
|
||||
@@ -52,7 +52,8 @@ tables:
|
||||
# etldoc: imposm3 -> osm_park_polygon
|
||||
park_polygon:
|
||||
type: polygon
|
||||
fields:
|
||||
_resolve_wikidata: false
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
|
||||
@@ -3,6 +3,7 @@ RETURNS INT AS $$
|
||||
SELECT CASE
|
||||
WHEN capital IN ('yes', '2') THEN 2
|
||||
WHEN capital = '4' THEN 4
|
||||
ELSE NULL
|
||||
END;
|
||||
$$ LANGUAGE SQL IMMUTABLE STRICT;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE STRICT PARALLEL SAFE;
|
||||
|
||||
@@ -52,4 +52,6 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text, name_de
|
||||
OR (zoom_level BETWEEN 11 AND 12 AND (gridrank <= 14 OR "rank" IS NOT NULL))
|
||||
OR (zoom_level >= 13)
|
||||
) as city_all;
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE PARALLEL SAFE;
|
||||
|
||||
|
Before Width: | Height: | Size: 141 KiB After Width: | Height: | Size: 137 KiB |
@@ -6,4 +6,6 @@ CREATE OR REPLACE FUNCTION island_rank(area REAL) RETURNS INT AS $$
|
||||
WHEN area > 40000000 THEN 3
|
||||
ELSE 7
|
||||
END;
|
||||
$$ LANGUAGE SQL IMMUTABLE STRICT;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE STRICT PARALLEL SAFE;
|
||||
|
||||
@@ -96,4 +96,6 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text,
|
||||
FROM layer_city(bbox, zoom_level, pixel_width)
|
||||
ORDER BY "rank" ASC
|
||||
) AS place_all
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE PARALLEL SAFE;
|
||||
|
||||
@@ -20,7 +20,7 @@ tables:
|
||||
# etldoc: imposm3 -> osm_continent_point
|
||||
continent_point:
|
||||
type: point
|
||||
fields:
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
@@ -40,7 +40,7 @@ tables:
|
||||
# etldoc: imposm3 -> osm_country_point
|
||||
country_point:
|
||||
type: point
|
||||
fields:
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
@@ -70,7 +70,7 @@ tables:
|
||||
# etldoc: imposm3 -> osm_island_polygon
|
||||
island_polygon:
|
||||
type: polygon
|
||||
fields:
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
@@ -93,7 +93,7 @@ tables:
|
||||
# etldoc: imposm3 -> osm_island_point
|
||||
island_point:
|
||||
type: point
|
||||
fields:
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
@@ -114,7 +114,7 @@ tables:
|
||||
# etldoc: imposm3 -> osm_state_point
|
||||
state_point:
|
||||
type: point
|
||||
fields:
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
@@ -144,7 +144,7 @@ tables:
|
||||
# etldoc: imposm3 -> osm_city_point
|
||||
city_point:
|
||||
type: point
|
||||
fields:
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
|
||||
@@ -25,44 +25,16 @@ RETURNS INT AS $$
|
||||
WHEN 'bar' THEN 800
|
||||
ELSE 1000
|
||||
END;
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE PARALLEL SAFE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION poi_class(subclass TEXT, mapping_key TEXT)
|
||||
RETURNS TEXT AS $$
|
||||
SELECT CASE
|
||||
WHEN subclass IN ('accessories','antiques','beauty','bed','boutique','camera','carpet','charity','chemist','coffee','computer','convenience','copyshop','cosmetics','garden_centre','doityourself','erotic','electronics','fabric','florist','frozen_food','furniture','video_games','video','general','gift','hardware','hearing_aids','hifi','ice_cream','interior_decoration','jewelry','kiosk','lamps','mall','massage','motorcycle','mobile_phone','newsagent','optician','outdoor','perfumery','perfume','pet','photo','second_hand','shoes','sports','stationery','tailor','tattoo','ticket','tobacco','toys','travel_agency','watches','weapons','wholesale') THEN 'shop'
|
||||
WHEN subclass IN ('townhall','public_building','courthouse','community_centre') THEN 'town_hall'
|
||||
WHEN subclass IN ('golf','golf_course','miniature_golf') THEN 'golf'
|
||||
WHEN subclass IN ('fast_food','food_court') THEN 'fast_food'
|
||||
WHEN subclass IN ('park','bbq') THEN 'park'
|
||||
WHEN subclass IN ('bus_stop','bus_station') THEN 'bus'
|
||||
WHEN (subclass='station' AND mapping_key = 'railway') OR subclass IN ('halt', 'tram_stop', 'subway') THEN 'railway'
|
||||
WHEN (subclass='station' AND mapping_key = 'aerialway') THEN 'aerialway'
|
||||
WHEN subclass IN ('subway_entrance','train_station_entrance') THEN 'entrance'
|
||||
WHEN subclass IN ('camp_site','caravan_site') THEN 'campsite'
|
||||
WHEN subclass IN ('laundry','dry_cleaning') THEN 'laundry'
|
||||
WHEN subclass IN ('supermarket','deli','delicatessen','department_store','greengrocer','marketplace') THEN 'grocery'
|
||||
WHEN subclass IN ('books','library') THEN 'library'
|
||||
WHEN subclass IN ('university','college') THEN 'college'
|
||||
WHEN subclass IN ('hotel','motel','bed_and_breakfast','guest_house','hostel','chalet','alpine_hut','dormitory') THEN 'lodging'
|
||||
WHEN subclass IN ('chocolate','confectionery') THEN 'ice_cream'
|
||||
WHEN subclass IN ('post_box','post_office') THEN 'post'
|
||||
WHEN subclass IN ('cafe') THEN 'cafe'
|
||||
WHEN subclass IN ('school','kindergarten') THEN 'school'
|
||||
WHEN subclass IN ('alcohol','beverages','wine') THEN 'alcohol_shop'
|
||||
WHEN subclass IN ('bar','nightclub') THEN 'bar'
|
||||
WHEN subclass IN ('marina','dock') THEN 'harbor'
|
||||
WHEN subclass IN ('car','car_repair','taxi') THEN 'car'
|
||||
WHEN subclass IN ('hospital','nursing_home', 'clinic') THEN 'hospital'
|
||||
WHEN subclass IN ('grave_yard','cemetery') THEN 'cemetery'
|
||||
WHEN subclass IN ('attraction','viewpoint') THEN 'attraction'
|
||||
WHEN subclass IN ('biergarten','pub') THEN 'beer'
|
||||
WHEN subclass IN ('music','musical_instrument') THEN 'music'
|
||||
WHEN subclass IN ('american_football','stadium','soccer') THEN 'stadium'
|
||||
WHEN subclass IN ('art','artwork','gallery','arts_centre') THEN 'art_gallery'
|
||||
WHEN subclass IN ('bag','clothes') THEN 'clothing_store'
|
||||
WHEN subclass IN ('swimming_area','swimming') THEN 'swimming'
|
||||
WHEN subclass IN ('castle','ruins') THEN 'castle'
|
||||
%%FIELD_MAPPING: class %%
|
||||
ELSE subclass
|
||||
END;
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE PARALLEL SAFE;
|
||||
|
||||
@@ -21,7 +21,7 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text, name_de
|
||||
agg_stop,
|
||||
NULLIF(layer, 0) AS layer,
|
||||
"level",
|
||||
CASE WHEN indoor=TRUE THEN 1 ELSE NULL END as indoor,
|
||||
CASE WHEN indoor=TRUE THEN 1 END as indoor,
|
||||
row_number() OVER (
|
||||
PARTITION BY LabelGrid(geometry, 100 * pixel_width)
|
||||
ORDER BY CASE WHEN name = '' THEN 2000 ELSE poi_class_rank(poi_class(subclass, mapping_key)) END ASC
|
||||
@@ -70,4 +70,6 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text, name_de
|
||||
) as poi_union
|
||||
ORDER BY "rank"
|
||||
;
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE PARALLEL SAFE;
|
||||
|
||||
@@ -381,11 +381,11 @@ tables:
|
||||
# etldoc: imposm3 -> osm_poi_point
|
||||
poi_point:
|
||||
type: point
|
||||
fields: *poi_fields
|
||||
columns: *poi_fields
|
||||
mapping: *poi_mapping
|
||||
|
||||
# etldoc: imposm3 -> osm_poi_polygon
|
||||
poi_polygon:
|
||||
type: polygon
|
||||
fields: *poi_fields
|
||||
columns: *poi_fields
|
||||
mapping: *poi_mapping
|
||||
|
||||
@@ -9,11 +9,91 @@ layer:
|
||||
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the POI.
|
||||
name_en: English name `name:en` if available, otherwise `name`.
|
||||
name_de: German name `name:de` if available, otherwise `name` or `name:en`.
|
||||
class: |
|
||||
class:
|
||||
description: |
|
||||
More general classes of POIs. If there is no more general `class` for the `subclass`
|
||||
this field will contain the same value as `subclass`.
|
||||
But for example for schools you only need to style the class `school` to filter the subclasses `school`
|
||||
and `kindergarten`. Or use the class `shop` to style all shops.
|
||||
values:
|
||||
shop:
|
||||
subclass: ['accessories', 'antiques', 'beauty', 'bed', 'boutique', 'camera', 'carpet', 'charity', 'chemist',
|
||||
'coffee', 'computer', 'convenience', 'copyshop', 'cosmetics', 'garden_centre', 'doityourself',
|
||||
'erotic', 'electronics', 'fabric', 'florist', 'frozen_food', 'furniture', 'video_games', 'video',
|
||||
'general', 'gift', 'hardware', 'hearing_aids', 'hifi', 'ice_cream', 'interior_decoration',
|
||||
'jewelry', 'kiosk', 'lamps', 'mall', 'massage', 'motorcycle', 'mobile_phone', 'newsagent',
|
||||
'optician', 'outdoor', 'perfumery', 'perfume', 'pet', 'photo', 'second_hand', 'shoes', 'sports',
|
||||
'stationery', 'tailor', 'tattoo', 'ticket', 'tobacco', 'toys', 'travel_agency', 'watches',
|
||||
'weapons', 'wholesale']
|
||||
town_hall:
|
||||
subclass: ['townhall', 'public_building', 'courthouse', 'community_centre']
|
||||
golf:
|
||||
subclass: ['golf', 'golf_course', 'miniature_golf']
|
||||
fast_food:
|
||||
subclass: ['fast_food', 'food_court']
|
||||
park:
|
||||
subclass: ['park', 'bbq']
|
||||
bus:
|
||||
subclass: ['bus_stop', 'bus_station']
|
||||
railway:
|
||||
- __AND__:
|
||||
subclass: 'station'
|
||||
mapping_key: 'railway'
|
||||
- subclass: ['halt', 'tram_stop', 'subway']
|
||||
aerialway:
|
||||
__AND__:
|
||||
subclass: 'station'
|
||||
mapping_key: 'aerialway'
|
||||
entrance:
|
||||
subclass: ['subway_entrance', 'train_station_entrance']
|
||||
campsite:
|
||||
subclass: ['camp_site', 'caravan_site']
|
||||
laundry:
|
||||
subclass: ['laundry', 'dry_cleaning']
|
||||
grocery:
|
||||
subclass: ['supermarket', 'deli', 'delicatessen', 'department_store', 'greengrocer', 'marketplace']
|
||||
library:
|
||||
subclass: ['books', 'library']
|
||||
college:
|
||||
subclass: ['university', 'college']
|
||||
lodging:
|
||||
subclass: ['hotel', 'motel', 'bed_and_breakfast', 'guest_house', 'hostel', 'chalet', 'alpine_hut', 'dormitory']
|
||||
ice_cream:
|
||||
subclass: ['chocolate', 'confectionery']
|
||||
post:
|
||||
subclass: ['post_box', 'post_office']
|
||||
cafe:
|
||||
subclass: ['cafe']
|
||||
school:
|
||||
subclass: ['school', 'kindergarten']
|
||||
alcohol_shop:
|
||||
subclass: ['alcohol', 'beverages', 'wine']
|
||||
bar:
|
||||
subclass: ['bar', 'nightclub']
|
||||
harbor:
|
||||
subclass: ['marina', 'dock']
|
||||
car:
|
||||
subclass: ['car', 'car_repair', 'taxi']
|
||||
hospital:
|
||||
subclass: ['hospital', 'nursing_home', 'clinic']
|
||||
cemetery:
|
||||
subclass: ['grave_yard', 'cemetery']
|
||||
attraction:
|
||||
subclass: ['attraction', 'viewpoint']
|
||||
beer:
|
||||
subclass: ['biergarten', 'pub']
|
||||
music:
|
||||
subclass: ['music', 'musical_instrument']
|
||||
stadium:
|
||||
subclass: ['american_football', 'stadium', 'soccer']
|
||||
art_gallery:
|
||||
subclass: ['art', 'artwork', 'gallery', 'arts_centre']
|
||||
clothing_store:
|
||||
subclass: ['bag', 'clothes']
|
||||
swimming:
|
||||
subclass: ['swimming_area', 'swimming']
|
||||
castle:
|
||||
subclass: ['castle', 'ruins']
|
||||
subclass:
|
||||
description: |
|
||||
Original value of either the
|
||||
|
||||
@@ -3,8 +3,7 @@ CREATE MATERIALIZED VIEW osm_poi_stop_centroid AS (
|
||||
SELECT
|
||||
uic_ref,
|
||||
count(*) as count,
|
||||
CASE WHEN count(*) > 2 THEN ST_Centroid(ST_UNION(geometry))
|
||||
ELSE NULL END AS centroid
|
||||
CASE WHEN count(*) > 2 THEN ST_Centroid(ST_UNION(geometry)) END AS centroid
|
||||
FROM osm_poi_point
|
||||
WHERE
|
||||
nullif(uic_ref, '') IS NOT NULL
|
||||
@@ -13,7 +12,7 @@ CREATE MATERIALIZED VIEW osm_poi_stop_centroid AS (
|
||||
uic_ref
|
||||
HAVING
|
||||
count(*) > 1
|
||||
);
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_poi_stop_rank CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_poi_stop_rank AS (
|
||||
@@ -33,7 +32,7 @@ CREATE MATERIALIZED VIEW osm_poi_stop_rank AS (
|
||||
WHERE
|
||||
subclass IN ('bus_stop', 'bus_station', 'tram_stop', 'subway')
|
||||
ORDER BY p.uic_ref, rk
|
||||
);
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
|
||||
ALTER TABLE osm_poi_point ADD COLUMN IF NOT EXISTS agg_stop INTEGER DEFAULT NULL;
|
||||
SELECT update_osm_poi_point_agg();
|
||||
SELECT update_osm_poi_point_agg();
|
||||
|
||||
@@ -27,7 +27,6 @@ BEGIN
|
||||
SET agg_stop = CASE
|
||||
WHEN p.subclass IN ('bus_stop', 'bus_station', 'tram_stop', 'subway')
|
||||
THEN 1
|
||||
ELSE NULL
|
||||
END;
|
||||
|
||||
UPDATE osm_poi_point p
|
||||
@@ -36,7 +35,6 @@ BEGIN
|
||||
WHEN p.subclass IN ('bus_stop', 'bus_station', 'tram_stop', 'subway')
|
||||
AND r.rk IS NULL OR r.rk = 1
|
||||
THEN 1
|
||||
ELSE NULL
|
||||
END)
|
||||
FROM osm_poi_stop_rank r
|
||||
WHERE p.osm_id = r.osm_id
|
||||
|
||||
@@ -3,36 +3,20 @@ CREATE OR REPLACE FUNCTION brunnel(is_bridge BOOL, is_tunnel BOOL, is_ford BOOL)
|
||||
WHEN is_bridge THEN 'bridge'
|
||||
WHEN is_tunnel THEN 'tunnel'
|
||||
WHEN is_ford THEN 'ford'
|
||||
ELSE NULL
|
||||
END;
|
||||
$$ LANGUAGE SQL IMMUTABLE STRICT;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE STRICT PARALLEL SAFE;
|
||||
|
||||
-- The classes for highways are derived from the classes used in ClearTables
|
||||
-- https://github.com/ClearTables/ClearTables/blob/master/transportation.lua
|
||||
CREATE OR REPLACE FUNCTION highway_class(highway TEXT, public_transport TEXT, construction TEXT) RETURNS TEXT AS $$
|
||||
SELECT CASE
|
||||
WHEN highway IN ('motorway', 'motorway_link') THEN 'motorway'
|
||||
WHEN highway IN ('trunk', 'trunk_link') THEN 'trunk'
|
||||
WHEN highway IN ('primary', 'primary_link') THEN 'primary'
|
||||
WHEN highway IN ('secondary', 'secondary_link') THEN 'secondary'
|
||||
WHEN highway IN ('tertiary', 'tertiary_link') THEN 'tertiary'
|
||||
WHEN highway IN ('unclassified', 'residential', 'living_street', 'road') THEN 'minor'
|
||||
WHEN highway IN ('pedestrian', 'path', 'footway', 'cycleway', 'steps', 'bridleway', 'corridor') OR public_transport IN ('platform') THEN 'path'
|
||||
WHEN highway IN ('service', 'track', 'raceway') THEN highway
|
||||
WHEN highway = 'construction' THEN CASE
|
||||
WHEN construction IN ('motorway', 'motorway_link') THEN 'motorway_construction'
|
||||
WHEN construction IN ('trunk', 'trunk_link') THEN 'trunk_construction'
|
||||
WHEN construction IN ('primary', 'primary_link') THEN 'primary_construction'
|
||||
WHEN construction IN ('secondary', 'secondary_link') THEN 'secondary_construction'
|
||||
WHEN construction IN ('tertiary', 'tertiary_link') THEN 'tertiary_construction'
|
||||
WHEN construction = '' OR construction IN ('unclassified', 'residential', 'living_street', 'road') THEN 'minor_construction'
|
||||
WHEN construction IN ('pedestrian', 'path', 'footway', 'cycleway', 'steps', 'bridleway', 'corridor') OR public_transport IN ('platform') THEN 'path_construction'
|
||||
WHEN construction IN ('service', 'track', 'raceway') THEN CONCAT(highway, '_construction')
|
||||
ELSE NULL
|
||||
END
|
||||
ELSE NULL
|
||||
%%FIELD_MAPPING: class %%
|
||||
END;
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE PARALLEL SAFE;
|
||||
|
||||
-- The classes for railways are derived from the classes used in ClearTables
|
||||
-- https://github.com/ClearTables/ClearTables/blob/master/transportation.lua
|
||||
@@ -40,18 +24,20 @@ CREATE OR REPLACE FUNCTION railway_class(railway TEXT) RETURNS TEXT AS $$
|
||||
SELECT CASE
|
||||
WHEN railway IN ('rail', 'narrow_gauge', 'preserved', 'funicular') THEN 'rail'
|
||||
WHEN railway IN ('subway', 'light_rail', 'monorail', 'tram') THEN 'transit'
|
||||
ELSE NULL
|
||||
END;
|
||||
$$ LANGUAGE SQL IMMUTABLE STRICT;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE STRICT PARALLEL SAFE;
|
||||
|
||||
-- Limit service to only the most important values to ensure
|
||||
-- we always know the values of service
|
||||
CREATE OR REPLACE FUNCTION service_value(service TEXT) RETURNS TEXT AS $$
|
||||
SELECT CASE
|
||||
WHEN service IN ('spur', 'yard', 'siding', 'crossover', 'driveway', 'alley', 'parking_aisle') THEN service
|
||||
ELSE NULL
|
||||
END;
|
||||
$$ LANGUAGE SQL IMMUTABLE STRICT;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE STRICT PARALLEL SAFE;
|
||||
|
||||
-- Limit surface to only the most important values to ensure
|
||||
-- we always know the values of surface
|
||||
@@ -59,6 +45,7 @@ CREATE OR REPLACE FUNCTION surface_value(surface TEXT) RETURNS TEXT AS $$
|
||||
SELECT CASE
|
||||
WHEN surface IN ('paved', 'asphalt', 'cobblestone', 'concrete', 'concrete:lanes', 'concrete:plates', 'metal', 'paving_stones', 'sett', 'unhewn_cobblestone', 'wood') THEN 'paved'
|
||||
WHEN surface IN ('unpaved', 'compacted', 'dirt', 'earth', 'fine_gravel', 'grass', 'grass_paver', 'gravel', 'gravel_turf', 'ground', 'ice', 'mud', 'pebblestone', 'salt', 'sand', 'snow', 'woodchips') THEN 'unpaved'
|
||||
ELSE NULL
|
||||
END;
|
||||
$$ LANGUAGE SQL IMMUTABLE STRICT;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE STRICT PARALLEL SAFE;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
CREATE OR REPLACE FUNCTION highway_is_link(highway TEXT) RETURNS BOOLEAN AS $$
|
||||
SELECT highway LIKE '%_link';
|
||||
$$ LANGUAGE SQL IMMUTABLE STRICT;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE STRICT PARALLEL SAFE;
|
||||
|
||||
|
||||
-- etldoc: layer_transportation[shape=record fillcolor=lightpink, style="rounded,filled",
|
||||
@@ -23,7 +25,6 @@ indoor INT, bicycle TEXT, foot TEXT, horse TEXT, mtb_scale TEXT, surface TEXT) A
|
||||
WHEN (highway IS NOT NULL OR public_transport IS NOT NULL)
|
||||
AND highway_class(highway, public_transport, construction) = 'path'
|
||||
THEN COALESCE(NULLIF(public_transport, ''), highway)
|
||||
ELSE NULL
|
||||
END AS subclass,
|
||||
-- All links are considered as ramps as well
|
||||
CASE WHEN highway_is_link(highway) OR highway = 'steps'
|
||||
@@ -33,7 +34,7 @@ indoor INT, bicycle TEXT, foot TEXT, horse TEXT, mtb_scale TEXT, surface TEXT) A
|
||||
NULLIF(service, '') AS service,
|
||||
NULLIF(layer, 0) AS layer,
|
||||
"level",
|
||||
CASE WHEN indoor=TRUE THEN 1 ELSE NULL END as indoor,
|
||||
CASE WHEN indoor=TRUE THEN 1 END as indoor,
|
||||
NULLIF(bicycle, '') AS bicycle,
|
||||
NULLIF(foot, '') AS foot,
|
||||
NULLIF(horse, '') AS horse,
|
||||
@@ -157,12 +158,8 @@ indoor INT, bicycle TEXT, foot TEXT, horse TEXT, mtb_scale TEXT, surface TEXT) A
|
||||
public_transport, service_value(service) AS service,
|
||||
is_bridge, is_tunnel, is_ford, is_ramp, is_oneway, man_made,
|
||||
layer,
|
||||
CASE WHEN highway IN ('footway', 'steps') THEN "level"
|
||||
ELSE NULL::int
|
||||
END AS "level",
|
||||
CASE WHEN highway IN ('footway', 'steps') THEN indoor
|
||||
ELSE NULL::boolean
|
||||
END AS indoor,
|
||||
CASE WHEN highway IN ('footway', 'steps') THEN "level" END AS "level",
|
||||
CASE WHEN highway IN ('footway', 'steps') THEN indoor END AS indoor,
|
||||
bicycle, foot, horse, mtb_scale,
|
||||
surface_value(surface) AS "surface",
|
||||
z_order
|
||||
@@ -371,4 +368,6 @@ indoor INT, bicycle TEXT, foot TEXT, horse TEXT, mtb_scale TEXT, surface TEXT) A
|
||||
) AS zoom_levels
|
||||
WHERE geometry && bbox
|
||||
ORDER BY z_order ASC;
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE PARALLEL SAFE;
|
||||
|
||||
@@ -158,7 +158,8 @@ tables:
|
||||
# etldoc: imposm3 -> osm_highway_linestring
|
||||
highway_linestring:
|
||||
type: linestring
|
||||
fields:
|
||||
_resolve_wikidata: false
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
@@ -231,7 +232,8 @@ tables:
|
||||
# etldoc: imposm3 -> osm_railway_linestring
|
||||
railway_linestring:
|
||||
type: linestring
|
||||
fields:
|
||||
_resolve_wikidata: false
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
@@ -273,7 +275,8 @@ tables:
|
||||
# etldoc: imposm3 -> osm_aerialway_linestring
|
||||
aerialway_linestring:
|
||||
type: linestring
|
||||
fields:
|
||||
_resolve_wikidata: false
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
@@ -305,7 +308,8 @@ tables:
|
||||
# etldoc: imposm3 -> osm_shipway_linestring
|
||||
shipway_linestring:
|
||||
type: linestring
|
||||
fields:
|
||||
_resolve_wikidata: false
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
@@ -336,7 +340,7 @@ tables:
|
||||
# etldoc: imposm3 -> osm_highway_polygon
|
||||
highway_polygon:
|
||||
type: polygon
|
||||
fields:
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
|
||||
|
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 134 KiB |
@@ -24,33 +24,69 @@ layer:
|
||||
shipping ways), or
|
||||
[`man_made`](http://wiki.openstreetmap.org/wiki/Key:route).
|
||||
values:
|
||||
- motorway
|
||||
- trunk
|
||||
- primary
|
||||
- secondary
|
||||
- tertiary
|
||||
- minor
|
||||
- service
|
||||
- track
|
||||
- path
|
||||
- raceway
|
||||
- motorway_construction
|
||||
- trunk_construction
|
||||
- primary_construction
|
||||
- secondary_construction
|
||||
- tertiary_construction
|
||||
- minor_construction
|
||||
- service_construction
|
||||
- track_construction
|
||||
- path_construction
|
||||
- raceway_construction
|
||||
- rail
|
||||
- transit
|
||||
- cable_car
|
||||
- gondola
|
||||
- ferry
|
||||
- bridge
|
||||
- pier
|
||||
motorway:
|
||||
highway: ['motorway', 'motorway_link']
|
||||
trunk:
|
||||
highway: ['trunk', 'trunk_link']
|
||||
primary:
|
||||
highway: ['primary', 'primary_link']
|
||||
secondary:
|
||||
highway: ['secondary', 'secondary_link']
|
||||
tertiary:
|
||||
highway: ['tertiary', 'tertiary_link']
|
||||
minor:
|
||||
highway: ['unclassified', 'residential', 'living_street', 'road']
|
||||
path:
|
||||
highway: ['pedestrian', 'path', 'footway', 'cycleway', 'steps', 'bridleway', 'corridor']
|
||||
public_transport: 'platform'
|
||||
service:
|
||||
highway: service
|
||||
track:
|
||||
highway: track
|
||||
raceway:
|
||||
highway: raceway
|
||||
motorway_construction:
|
||||
__AND__:
|
||||
highway: construction
|
||||
construction: ['motorway', 'motorway_link']
|
||||
trunk_construction:
|
||||
__AND__:
|
||||
highway: construction
|
||||
construction: ['trunk', 'trunk_link']
|
||||
primary_construction:
|
||||
__AND__:
|
||||
highway: construction
|
||||
construction: ['primary', 'primary_link']
|
||||
secondary_construction:
|
||||
__AND__:
|
||||
highway: construction
|
||||
construction: ['secondary', 'secondary_link']
|
||||
tertiary_construction:
|
||||
__AND__:
|
||||
highway: construction
|
||||
construction: ['tertiary', 'tertiary_link']
|
||||
minor_construction:
|
||||
__AND__:
|
||||
highway: construction
|
||||
construction: ['', 'unclassified', 'residential', 'living_street', 'road']
|
||||
path_construction:
|
||||
__AND__:
|
||||
- highway: construction
|
||||
- __OR__:
|
||||
construction: ['pedestrian', 'path', 'footway', 'cycleway', 'steps', 'bridleway', 'corridor']
|
||||
public_transport: platform
|
||||
service_construction:
|
||||
__AND__:
|
||||
highway: construction
|
||||
construction: service
|
||||
track_construction:
|
||||
__AND__:
|
||||
highway: construction
|
||||
construction: track
|
||||
raceway_construction:
|
||||
__AND__:
|
||||
highway: construction
|
||||
construction: raceway
|
||||
subclass:
|
||||
description: |
|
||||
Distinguish more specific classes of railway and path:
|
||||
|
||||
@@ -41,7 +41,7 @@ CREATE MATERIALIZED VIEW osm_transportation_merge_linestring AS (
|
||||
AND ST_IsValid(geometry)
|
||||
group by highway, construction
|
||||
) AS highway_union
|
||||
);
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_geometry_idx
|
||||
ON osm_transportation_merge_linestring USING gist(geometry);
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_highway_partial_idx
|
||||
@@ -54,7 +54,7 @@ CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen3 AS (
|
||||
FROM osm_transportation_merge_linestring
|
||||
WHERE highway IN ('motorway','trunk', 'primary')
|
||||
OR highway = 'construction' AND construction IN ('motorway','trunk', 'primary')
|
||||
);
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen3_geometry_idx
|
||||
ON osm_transportation_merge_linestring_gen3 USING gist(geometry);
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen3_highway_partial_idx
|
||||
@@ -67,7 +67,7 @@ CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen4 AS (
|
||||
FROM osm_transportation_merge_linestring_gen3
|
||||
WHERE (highway IN ('motorway','trunk', 'primary') OR highway = 'construction' AND construction IN ('motorway','trunk', 'primary'))
|
||||
AND ST_Length(geometry) > 50
|
||||
);
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen4_geometry_idx
|
||||
ON osm_transportation_merge_linestring_gen4 USING gist(geometry);
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen4_highway_partial_idx
|
||||
@@ -80,7 +80,7 @@ CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen5 AS (
|
||||
FROM osm_transportation_merge_linestring_gen4
|
||||
WHERE (highway IN ('motorway','trunk') OR highway = 'construction' AND construction IN ('motorway','trunk'))
|
||||
AND ST_Length(geometry) > 100
|
||||
);
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen5_geometry_idx
|
||||
ON osm_transportation_merge_linestring_gen5 USING gist(geometry);
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen5_highway_partial_idx
|
||||
@@ -92,7 +92,7 @@ CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen6 AS (
|
||||
SELECT ST_Simplify(geometry, 1000) AS geometry, osm_id, highway, construction, z_order
|
||||
FROM osm_transportation_merge_linestring_gen5
|
||||
WHERE (highway IN ('motorway','trunk') OR highway = 'construction' AND construction IN ('motorway','trunk')) AND ST_Length(geometry) > 500
|
||||
);
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen6_geometry_idx
|
||||
ON osm_transportation_merge_linestring_gen6 USING gist(geometry);
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen6_highway_partial_idx
|
||||
@@ -104,7 +104,7 @@ CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen7 AS (
|
||||
SELECT ST_Simplify(geometry, 2000) AS geometry, osm_id, highway, construction, z_order
|
||||
FROM osm_transportation_merge_linestring_gen6
|
||||
WHERE (highway = 'motorway' OR highway = 'construction' AND construction = 'motorway') AND ST_Length(geometry) > 1000
|
||||
);
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen7_geometry_idx
|
||||
ON osm_transportation_merge_linestring_gen7 USING gist(geometry);
|
||||
|
||||
|
||||
@@ -23,11 +23,10 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text,
|
||||
CASE
|
||||
WHEN highway IS NOT NULL AND highway_class(highway, '', construction) = 'path'
|
||||
THEN highway
|
||||
ELSE NULL
|
||||
END AS subclass,
|
||||
NULLIF(layer, 0) AS layer,
|
||||
"level",
|
||||
CASE WHEN indoor=TRUE THEN 1 ELSE NULL END as indoor
|
||||
CASE WHEN indoor=TRUE THEN 1 END as indoor
|
||||
FROM (
|
||||
|
||||
-- etldoc: osm_transportation_name_linestring_gen4 -> layer_transportation_name:z6
|
||||
@@ -127,4 +126,6 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text,
|
||||
) AS zoom_levels
|
||||
WHERE geometry && bbox
|
||||
ORDER BY z_order ASC;
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE PARALLEL SAFE;
|
||||
|
||||
|
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 134 KiB |
@@ -56,7 +56,6 @@ BEGIN
|
||||
THEN 'ca-transcanada'::route_network_type
|
||||
WHEN network = 'omt-gb-motorway' THEN 'gb-motorway'::route_network_type
|
||||
WHEN network = 'omt-gb-trunk' THEN 'gb-trunk'::route_network_type
|
||||
ELSE NULL
|
||||
END
|
||||
;
|
||||
|
||||
|
||||
@@ -25,21 +25,15 @@ CREATE MATERIALIZED VIEW osm_transportation_name_network AS (
|
||||
end as ref,
|
||||
hl.highway,
|
||||
hl.construction,
|
||||
CASE WHEN highway IN ('footway', 'steps') THEN layer
|
||||
ELSE NULL::int
|
||||
END AS layer,
|
||||
CASE WHEN highway IN ('footway', 'steps') THEN "level"
|
||||
ELSE NULL::int
|
||||
END AS "level",
|
||||
CASE WHEN highway IN ('footway', 'steps') THEN indoor
|
||||
ELSE NULL::boolean
|
||||
END AS indoor,
|
||||
CASE WHEN highway IN ('footway', 'steps') THEN layer END AS layer,
|
||||
CASE WHEN highway IN ('footway', 'steps') THEN "level" END AS "level",
|
||||
CASE WHEN highway IN ('footway', 'steps') THEN indoor END AS indoor,
|
||||
ROW_NUMBER() OVER(PARTITION BY hl.osm_id
|
||||
ORDER BY rm.network_type) AS "rank",
|
||||
hl.z_order
|
||||
FROM osm_highway_linestring hl
|
||||
left join osm_route_member rm on (rm.member = hl.osm_id)
|
||||
);
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_network_geometry_idx ON osm_transportation_name_network USING gist(geometry);
|
||||
|
||||
|
||||
@@ -82,7 +76,7 @@ CREATE MATERIALIZED VIEW osm_transportation_name_linestring AS (
|
||||
AND NULLIF(highway, '') IS NOT NULL
|
||||
group by name, name_en, name_de, ref, highway, construction, "level", layer, indoor, network_type
|
||||
) AS highway_union
|
||||
);
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_geometry_idx ON osm_transportation_name_linestring USING gist(geometry);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_highway_partial_idx
|
||||
@@ -94,7 +88,7 @@ CREATE MATERIALIZED VIEW osm_transportation_name_linestring_gen1 AS (
|
||||
SELECT ST_Simplify(geometry, 50) AS geometry, osm_id, name, name_en, name_de, tags, ref, highway, construction, network, z_order
|
||||
FROM osm_transportation_name_linestring
|
||||
WHERE (highway IN ('motorway','trunk') OR highway = 'construction' AND construction IN ('motorway','trunk')) AND ST_Length(geometry) > 8000
|
||||
);
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen1_geometry_idx ON osm_transportation_name_linestring_gen1 USING gist(geometry);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen1_highway_partial_idx
|
||||
@@ -106,7 +100,7 @@ CREATE MATERIALIZED VIEW osm_transportation_name_linestring_gen2 AS (
|
||||
SELECT ST_Simplify(geometry, 120) AS geometry, osm_id, name, name_en, name_de, tags, ref, highway, construction, network, z_order
|
||||
FROM osm_transportation_name_linestring_gen1
|
||||
WHERE (highway IN ('motorway','trunk') OR highway = 'construction' AND construction IN ('motorway','trunk')) AND ST_Length(geometry) > 14000
|
||||
);
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen2_geometry_idx ON osm_transportation_name_linestring_gen2 USING gist(geometry);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen2_highway_partial_idx
|
||||
@@ -118,7 +112,7 @@ CREATE MATERIALIZED VIEW osm_transportation_name_linestring_gen3 AS (
|
||||
SELECT ST_Simplify(geometry, 200) AS geometry, osm_id, name, name_en, name_de, tags, ref, highway, construction, network, z_order
|
||||
FROM osm_transportation_name_linestring_gen2
|
||||
WHERE (highway = 'motorway' OR highway = 'construction' AND construction = 'motorway') AND ST_Length(geometry) > 20000
|
||||
);
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen3_geometry_idx ON osm_transportation_name_linestring_gen3 USING gist(geometry);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen3_highway_partial_idx
|
||||
@@ -130,7 +124,7 @@ CREATE MATERIALIZED VIEW osm_transportation_name_linestring_gen4 AS (
|
||||
SELECT ST_Simplify(geometry, 500) AS geometry, osm_id, name, name_en, name_de, tags, ref, highway, construction, network, z_order
|
||||
FROM osm_transportation_name_linestring_gen3
|
||||
WHERE (highway = 'motorway' OR highway = 'construction' AND construction = 'motorway') AND ST_Length(geometry) > 20000
|
||||
);
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen4_geometry_idx ON osm_transportation_name_linestring_gen4 USING gist(geometry);
|
||||
|
||||
-- Handle updates
|
||||
|
||||
|
Before Width: | Height: | Size: 274 KiB After Width: | Height: | Size: 298 KiB |
@@ -49,7 +49,7 @@ tables:
|
||||
|
||||
# etldoc: imposm3 -> osm_water_polygon
|
||||
water_polygon:
|
||||
fields:
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
|
||||
@@ -1,20 +1,66 @@
|
||||
-- This statement can be deleted after the water importer image stops creating this object as a table
|
||||
DO $$ BEGIN DROP TABLE IF EXISTS osm_ocean_polygon_gen1 CASCADE; EXCEPTION WHEN wrong_object_type THEN END; $$ language 'plpgsql';
|
||||
-- etldoc: osm_ocean_polygon -> osm_ocean_polygon_gen1
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_ocean_polygon_gen1 CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_ocean_polygon_gen1 AS (
|
||||
SELECT ST_Simplify(geometry, 20) AS geometry
|
||||
FROM osm_ocean_polygon
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS osm_ocean_polygon_gen1_idx ON osm_ocean_polygon_gen1 USING gist (geometry);
|
||||
|
||||
|
||||
-- This statement can be deleted after the water importer image stops creating this object as a table
|
||||
DO $$ BEGIN DROP TABLE IF EXISTS osm_ocean_polygon_gen2 CASCADE; EXCEPTION WHEN wrong_object_type THEN END; $$ language 'plpgsql';
|
||||
-- etldoc: osm_ocean_polygon -> osm_ocean_polygon_gen2
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_ocean_polygon_gen2 CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_ocean_polygon_gen2 AS (
|
||||
SELECT ST_Simplify(geometry, 40) AS geometry
|
||||
FROM osm_ocean_polygon
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS osm_ocean_polygon_gen2_idx ON osm_ocean_polygon_gen2 USING gist (geometry);
|
||||
|
||||
|
||||
-- This statement can be deleted after the water importer image stops creating this object as a table
|
||||
DO $$ BEGIN DROP TABLE IF EXISTS osm_ocean_polygon_gen3 CASCADE; EXCEPTION WHEN wrong_object_type THEN END; $$ language 'plpgsql';
|
||||
-- etldoc: osm_ocean_polygon -> osm_ocean_polygon_gen3
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_ocean_polygon_gen3 CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_ocean_polygon_gen3 AS (
|
||||
SELECT ST_Simplify(geometry, 80) AS geometry
|
||||
FROM osm_ocean_polygon
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS osm_ocean_polygon_gen3_idx ON osm_ocean_polygon_gen3 USING gist (geometry);
|
||||
|
||||
|
||||
-- This statement can be deleted after the water importer image stops creating this object as a table
|
||||
DO $$ BEGIN DROP TABLE IF EXISTS osm_ocean_polygon_gen4 CASCADE; EXCEPTION WHEN wrong_object_type THEN END; $$ language 'plpgsql';
|
||||
-- etldoc: osm_ocean_polygon -> osm_ocean_polygon_gen4
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_ocean_polygon_gen4 CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_ocean_polygon_gen4 AS (
|
||||
SELECT ST_Simplify(geometry, 160) AS geometry
|
||||
FROM osm_ocean_polygon
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */ ;
|
||||
CREATE INDEX IF NOT EXISTS osm_ocean_polygon_gen4_idx ON osm_ocean_polygon_gen4 USING gist (geometry);
|
||||
|
||||
|
||||
|
||||
CREATE OR REPLACE FUNCTION water_class(waterway TEXT) RETURNS TEXT AS $$
|
||||
SELECT CASE
|
||||
WHEN waterway='' THEN 'lake'
|
||||
WHEN waterway='lake' THEN 'lake'
|
||||
WHEN waterway='dock' THEN 'dock'
|
||||
%%FIELD_MAPPING: class %%
|
||||
ELSE 'river'
|
||||
END;
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE PARALLEL SAFE;
|
||||
|
||||
|
||||
CREATE OR REPLACE FUNCTION waterway_brunnel(is_bridge BOOL, is_tunnel BOOL) RETURNS TEXT AS $$
|
||||
SELECT CASE
|
||||
WHEN is_bridge THEN 'bridge'
|
||||
WHEN is_tunnel THEN 'tunnel'
|
||||
ELSE NULL
|
||||
END;
|
||||
$$ LANGUAGE SQL IMMUTABLE STRICT;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE STRICT PARALLEL SAFE;
|
||||
|
||||
|
||||
|
||||
@@ -333,4 +379,6 @@ RETURNS TABLE(geometry geometry, class text, brunnel text, intermittent int) AS
|
||||
SELECT * FROM water_z14 WHERE zoom_level >= 14
|
||||
) AS zoom_levels
|
||||
WHERE geometry && bbox;
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE PARALLEL SAFE;
|
||||
|
||||
@@ -14,9 +14,12 @@ layer:
|
||||
All water polygons from [OpenStreetMapData](http://osmdata.openstreetmap.de/) have the class `ocean`.
|
||||
Water bodies are classified as `lake` or `river` for water bodies with the [`waterway`](http://wiki.openstreetmap.org/wiki/Key:waterway) tag.
|
||||
values:
|
||||
- ocean
|
||||
- lake
|
||||
- river
|
||||
lake:
|
||||
waterway: ['', 'lake']
|
||||
dock:
|
||||
waterway: 'dock'
|
||||
river:
|
||||
ocean:
|
||||
intermittent:
|
||||
description: |
|
||||
Mark with `1` if it is an [intermittent](http://wiki.openstreetmap.org/wiki/Key:intermittent) water polygon.
|
||||
|
||||
|
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 132 KiB |
@@ -54,4 +54,6 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text, name_de
|
||||
OR (zoom_level >= "rank" AND "rank" IS NOT NULL)
|
||||
OR (zoom_level >= 8)
|
||||
);
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE PARALLEL SAFE;
|
||||
|
||||
@@ -2,7 +2,7 @@ tables:
|
||||
# etldoc: imposm3 -> osm_marine_point
|
||||
marine_point:
|
||||
type: point
|
||||
fields:
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
|
||||
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 26 KiB |
@@ -15,7 +15,7 @@ CREATE MATERIALIZED VIEW osm_water_lakeline AS (
|
||||
FROM osm_water_polygon AS wp
|
||||
INNER JOIN lake_centerline ll ON wp.osm_id = ll.osm_id
|
||||
WHERE wp.name <> '' AND ST_IsValid(wp.geometry)
|
||||
);
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_water_lakeline_geometry_idx ON osm_water_lakeline USING gist(geometry);
|
||||
|
||||
-- Handle updates
|
||||
|
||||
@@ -15,7 +15,7 @@ CREATE MATERIALIZED VIEW osm_water_point AS (
|
||||
FROM osm_water_polygon AS wp
|
||||
LEFT JOIN lake_centerline ll ON wp.osm_id = ll.osm_id
|
||||
WHERE ll.osm_id IS NULL AND wp.name <> ''
|
||||
);
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_water_point_geometry_idx ON osm_water_point USING gist (geometry);
|
||||
|
||||
-- Handle updates
|
||||
|
||||
@@ -28,7 +28,7 @@ tables:
|
||||
# etldoc: imposm3 -> osm_waterway_linestring
|
||||
waterway_linestring:
|
||||
type: linestring
|
||||
fields:
|
||||
columns:
|
||||
- name: osm_id
|
||||
type: id
|
||||
- name: geometry
|
||||
|
||||
@@ -30,7 +30,7 @@ CREATE MATERIALIZED VIEW osm_important_waterway_linestring AS (
|
||||
WHERE name <> '' AND waterway = 'river' AND ST_IsValid(geometry)
|
||||
GROUP BY name, name_en, name_de, slice_language_tags(tags)
|
||||
) AS waterway_union
|
||||
);
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_important_waterway_linestring_geometry_idx ON osm_important_waterway_linestring USING gist(geometry);
|
||||
|
||||
-- etldoc: osm_important_waterway_linestring -> osm_important_waterway_linestring_gen1
|
||||
@@ -38,7 +38,7 @@ CREATE MATERIALIZED VIEW osm_important_waterway_linestring_gen1 AS (
|
||||
SELECT ST_Simplify(geometry, 60) AS geometry, name, name_en, name_de, tags
|
||||
FROM osm_important_waterway_linestring
|
||||
WHERE ST_Length(geometry) > 1000
|
||||
);
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_important_waterway_linestring_gen1_geometry_idx ON osm_important_waterway_linestring_gen1 USING gist(geometry);
|
||||
|
||||
-- etldoc: osm_important_waterway_linestring_gen1 -> osm_important_waterway_linestring_gen2
|
||||
@@ -46,7 +46,7 @@ CREATE MATERIALIZED VIEW osm_important_waterway_linestring_gen2 AS (
|
||||
SELECT ST_Simplify(geometry, 100) AS geometry, name, name_en, name_de, tags
|
||||
FROM osm_important_waterway_linestring_gen1
|
||||
WHERE ST_Length(geometry) > 4000
|
||||
);
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_important_waterway_linestring_gen2_geometry_idx ON osm_important_waterway_linestring_gen2 USING gist(geometry);
|
||||
|
||||
-- etldoc: osm_important_waterway_linestring_gen2 -> osm_important_waterway_linestring_gen3
|
||||
@@ -54,7 +54,7 @@ CREATE MATERIALIZED VIEW osm_important_waterway_linestring_gen3 AS (
|
||||
SELECT ST_Simplify(geometry, 200) AS geometry, name, name_en, name_de, tags
|
||||
FROM osm_important_waterway_linestring_gen2
|
||||
WHERE ST_Length(geometry) > 8000
|
||||
);
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_important_waterway_linestring_gen3_geometry_idx ON osm_important_waterway_linestring_gen3 USING gist(geometry);
|
||||
|
||||
-- Handle updates
|
||||
|
||||
@@ -2,9 +2,10 @@ CREATE OR REPLACE FUNCTION waterway_brunnel(is_bridge BOOL, is_tunnel BOOL) RETU
|
||||
SELECT CASE
|
||||
WHEN is_bridge THEN 'bridge'
|
||||
WHEN is_tunnel THEN 'tunnel'
|
||||
ELSE NULL
|
||||
END;
|
||||
$$ LANGUAGE SQL IMMUTABLE STRICT;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE STRICT PARALLEL SAFE;
|
||||
|
||||
-- etldoc: ne_110m_rivers_lake_centerlines -> waterway_z3
|
||||
CREATE OR REPLACE VIEW waterway_z3 AS (
|
||||
@@ -106,4 +107,6 @@ RETURNS TABLE(geometry geometry, class text, name text, name_en text, name_de te
|
||||
SELECT * FROM waterway_z14 WHERE zoom_level >= 14
|
||||
) AS zoom_levels
|
||||
WHERE geometry && bbox;
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
$$
|
||||
LANGUAGE SQL
|
||||
IMMUTABLE PARALLEL SAFE;
|
||||
|
||||