Merge branch 'master' into refactor-landcover

This commit is contained in:
Eva Jelinkova
2019-11-05 12:02:37 +01:00
committed by GitHub
57 changed files with 392 additions and 264 deletions

View File

@@ -27,6 +27,8 @@ layer:
ele_ft: Elevation (`ele`) in feets.
datasource:
geometry_field: geometry
key_field: osm_id
key_field_as_attribute: no
srid: 900913
query: (SELECT osm_id, geometry, name, name_en, name_de, {name_languages}, class, iata, icao, ele, ele_ft FROM layer_aerodrome_label (!bbox!, z(!scale_denominator!), !pixel_width!)) AS t
schema:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 B

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 218 KiB

After

Width:  |  Height:  |  Size: 229 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 B

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 KiB

After

Width:  |  Height:  |  Size: 208 KiB

View File

@@ -15,11 +15,11 @@ CREATE OR REPLACE FUNCTION landcover_class(subclass VARCHAR) RETURNS TEXT AS $$
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 ('grassland', 'grass', 'meadow', 'allotments', 'grassland',
'park', 'village_green', 'recreation_ground', 'park', 'garden') THEN 'grass'
WHEN subclass IN ('fell', 'grassland', 'heath', 'scrub', 'tundra', 'grass', 'meadow', 'allotments',
'park', 'village_green', 'recreation_ground', 'garden') THEN 'grass'
WHEN subclass IN ('wetland', 'bog', 'swamp', 'wet_meadow', 'marsh', 'reedbed',
'saltern', 'tidalflat', 'saltmarsh', 'mangrove') THEN 'wetland'
WHEN subclass IN ('beach', 'sand') THEN 'sand'
WHEN subclass IN ('beach', 'sand', 'dune') THEN 'sand'
ELSE NULL
END;
$$ LANGUAGE SQL IMMUTABLE;

View File

@@ -29,13 +29,17 @@ layer:
- bare_rock
- beach
- bog
- dune
- scrub
- farm
- farmland
- fell
- forest
- garden
- glacier
- grass
- grassland
- heath
- mangrove
- marsh
- meadow
@@ -50,6 +54,7 @@ layer:
- scree
- swamp
- tidalflat
- tundra
- village_green
- vineyard
- wet_meadow

View File

@@ -78,12 +78,17 @@ tables:
natural:
- wood
- wetland
- fell
- grassland
- heath
- scrub
- tundra
- glacier
- bare_rock
- scree
- beach
- sand
- dune
leisure:
- park
- garden

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 KiB

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -45,7 +45,9 @@ $$
) DESC
)::int AS "rank"
FROM osm_peak_point
WHERE geometry && bbox AND ele is not null AND ele ~ E'^-?\\d+'
WHERE geometry && bbox
AND ele is not null
AND ele ~ E'^-?\\d{1,4}(\\D|$)'
) AS ranked_peaks
WHERE zoom_level >= 7 AND (rank <= 5 OR zoom_level >= 14)
ORDER BY "rank" ASC;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@@ -8,7 +8,7 @@ layer:
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Key:name) value of the peak.
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: |
Use the **class** to differentiate between mountain peak and volcano.
values:
@@ -19,6 +19,8 @@ layer:
rank: Rank of the peak within one tile (starting at 1 that is the most important peak).
datasource:
geometry_field: geometry
key_field: osm_id
key_field_as_attribute: no
srid: 900913
query: (SELECT osm_id, geometry, name, name_en, name_de, {name_languages}, class, ele, ele_ft, rank FROM layer_mountain_peak(!bbox!, z(!scale_denominator!), !pixel_width!)) AS t
schema:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

@@ -30,7 +30,7 @@ $$ LANGUAGE SQL IMMUTABLE;
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','chocolate','coffee','computer','confectionery','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 ('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'

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -314,134 +314,78 @@ def_poi_mapping_tourism: &poi_mapping_tourism
def_poi_mapping_waterway: &poi_mapping_waterway
- dock
def_poi_fields: &poi_fields
- name: osm_id
type: id
- name: geometry
type: geometry
- name: name
key: name
type: string
- name: name_en
key: name:en
type: string
- name: name_de
key: name:de
type: string
- name: tags
type: hstore_tags
- name: subclass
type: mapping_value
- name: mapping_key
type: mapping_key
- name: station
key: station
type: string
- name: funicular
key: funicular
type: string
- name: information
key: information
type: string
- name: uic_ref
key: uic_ref
type: string
- name: religion
key: religion
type: string
- name: level
key: level
type: integer
- name: indoor
key: indoor
type: bool
- name: layer
key: layer
type: integer
- name: sport
key: sport
type: string
def_poi_mapping: &poi_mapping
aerialway: *poi_mapping_aerialway
amenity: *poi_mapping_amenity
barrier: *poi_mapping_barrier
building: *poi_mapping_building
highway: *poi_mapping_highway
historic: *poi_mapping_historic
landuse: *poi_mapping_landuse
leisure: *poi_mapping_leisure
railway: *poi_mapping_railway
shop: *poi_mapping_shop
sport: *poi_mapping_sport
tourism: *poi_mapping_tourism
waterway: *poi_mapping_waterway
tables:
# etldoc: imposm3 -> osm_poi_point
poi_point:
type: point
fields:
- name: osm_id
type: id
- name: geometry
type: geometry
- name: name
key: name
type: string
- name: name_en
key: name:en
type: string
- name: name_de
key: name:de
type: string
- name: tags
type: hstore_tags
- name: subclass
type: mapping_value
- name: mapping_key
type: mapping_key
- name: station
key: station
type: string
- name: funicular
key: funicular
type: string
- name: information
key: information
type: string
- name: uic_ref
key: uic_ref
type: string
- name: religion
key: religion
type: string
- name: level
key: level
type: integer
- name: indoor
key: indoor
type: bool
- name: layer
key: layer
type: integer
- name: sport
key: sport
type: string
mapping:
aerialway: *poi_mapping_aerialway
amenity: *poi_mapping_amenity
barrier: *poi_mapping_barrier
building: *poi_mapping_building
highway: *poi_mapping_highway
historic: *poi_mapping_historic
landuse: *poi_mapping_landuse
leisure: *poi_mapping_leisure
railway: *poi_mapping_railway
shop: *poi_mapping_shop
sport: *poi_mapping_sport
tourism: *poi_mapping_tourism
waterway: *poi_mapping_waterway
fields: *poi_fields
mapping: *poi_mapping
# etldoc: imposm3 -> osm_poi_polygon
poi_polygon:
type: polygon
fields:
- name: osm_id
type: id
- name: geometry
type: geometry
- name: name
key: name
type: string
- name: name_en
key: name:en
type: string
- name: name_de
key: name:de
type: string
- name: tags
type: hstore_tags
- name: subclass
type: mapping_value
- name: mapping_key
type: mapping_key
- name: station
key: station
type: string
- name: funicular
key: funicular
type: string
- name: information
key: information
type: string
- name: uic_ref
key: uic_ref
type: string
- name: religion
key: religion
type: string
- name: level
key: level
type: integer
- name: indoor
key: indoor
type: bool
- name: layer
key: layer
type: integer
- name: sport
key: sport
type: string
mapping:
aerialway: *poi_mapping_aerialway
amenity: *poi_mapping_amenity
barrier: *poi_mapping_barrier
building: *poi_mapping_building
highway: *poi_mapping_highway
historic: *poi_mapping_historic
landuse: *poi_mapping_landuse
leisure: *poi_mapping_leisure
railway: *poi_mapping_railway
shop: *poi_mapping_shop
sport: *poi_mapping_sport
tourism: *poi_mapping_tourism
waterway: *poi_mapping_waterway
fields: *poi_fields
mapping: *poi_mapping

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

@@ -9,7 +9,7 @@ $$ LANGUAGE SQL IMMUTABLE STRICT;
-- 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) RETURNS TEXT AS $$
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'
@@ -17,9 +17,19 @@ CREATE OR REPLACE FUNCTION highway_class(highway TEXT, public_transport TEXT) RE
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 ('service', 'track') THEN highway
WHEN highway IN ('pedestrian', 'path', 'footway', 'cycleway', 'steps', 'bridleway', 'corridor') OR public_transport IN ('platform') THEN 'path'
WHEN highway = 'raceway' THEN 'raceway'
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
END;
$$ LANGUAGE SQL IMMUTABLE;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 436 KiB

After

Width:  |  Height:  |  Size: 491 KiB

View File

@@ -8,11 +8,11 @@ $$ LANGUAGE SQL IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION layer_transportation(bbox geometry, zoom_level int)
RETURNS TABLE(osm_id bigint, geometry geometry, class text, subclass text,
ramp int, oneway int, brunnel TEXT, service TEXT, layer INT, level INT,
indoor INT, surface TEXT) AS $$
indoor INT, bicycle TEXT, foot TEXT, horse TEXT, mtb_scale TEXT, surface TEXT) AS $$
SELECT
osm_id, geometry,
CASE
WHEN NULLIF(highway, '') IS NOT NULL OR NULLIF(public_transport, '') IS NOT NULL THEN highway_class(highway, public_transport)
WHEN NULLIF(highway, '') IS NOT NULL OR NULLIF(public_transport, '') IS NOT NULL THEN highway_class(highway, public_transport, construction)
WHEN NULLIF(railway, '') IS NOT NULL THEN railway_class(railway)
WHEN NULLIF(aerialway, '') IS NOT NULL THEN aerialway
WHEN NULLIF(shipway, '') IS NOT NULL THEN shipway
@@ -21,7 +21,7 @@ indoor INT, surface TEXT) AS $$
CASE
WHEN railway IS NOT NULL THEN railway
WHEN (highway IS NOT NULL OR public_transport IS NOT NULL)
AND highway_class(highway, public_transport) = 'path'
AND highway_class(highway, public_transport, construction) = 'path'
THEN COALESCE(NULLIF(public_transport, ''), highway)
ELSE NULL
END AS subclass,
@@ -34,19 +34,23 @@ indoor INT, surface TEXT) AS $$
NULLIF(layer, 0) AS layer,
"level",
CASE WHEN indoor=TRUE THEN 1 ELSE NULL END as indoor,
NULLIF(bicycle, '') AS bicycle,
NULLIF(foot, '') AS foot,
NULLIF(horse, '') AS horse,
NULLIF(mtb_scale, '') AS mtb_scale,
NULLIF(surface, '') AS surface
FROM (
-- etldoc: osm_transportation_merge_linestring_gen7 -> layer_transportation:z4
SELECT
osm_id, geometry,
highway, NULL AS railway, NULL AS aerialway, NULL AS shipway,
highway, construction, NULL AS railway, NULL AS aerialway, NULL AS shipway,
NULL AS public_transport, NULL AS service,
NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel,
NULL::boolean AS is_ford,
NULL::boolean AS is_ramp, NULL::int AS is_oneway, NULL as man_made,
NULL::int AS layer, NULL::int AS level, NULL::boolean AS indoor,
NULL AS surface,
z_order
NULL as bicycle, NULL as foot, NULL as horse, NULL as mtb_scale,
NULL AS surface, z_order
FROM osm_transportation_merge_linestring_gen7
WHERE zoom_level = 4
UNION ALL
@@ -54,12 +58,13 @@ indoor INT, surface TEXT) AS $$
-- etldoc: osm_transportation_merge_linestring_gen6 -> layer_transportation:z5
SELECT
osm_id, geometry,
highway, NULL AS railway, NULL AS aerialway, NULL AS shipway,
highway, construction, NULL AS railway, NULL AS aerialway, NULL AS shipway,
NULL AS public_transport, NULL AS service,
NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel,
NULL::boolean AS is_ford,
NULL::boolean AS is_ramp, NULL::int AS is_oneway, NULL as man_made,
NULL::int AS layer, NULL::int AS level, NULL::boolean AS indoor,
NULL as bicycle, NULL as foot, NULL as horse, NULL as mtb_scale,
NULL AS surface, z_order
FROM osm_transportation_merge_linestring_gen6
WHERE zoom_level = 5
@@ -68,12 +73,13 @@ indoor INT, surface TEXT) AS $$
-- etldoc: osm_transportation_merge_linestring_gen5 -> layer_transportation:z6
SELECT
osm_id, geometry,
highway, NULL AS railway, NULL AS aerialway, NULL AS shipway,
highway, construction, NULL AS railway, NULL AS aerialway, NULL AS shipway,
NULL AS public_transport, NULL AS service,
NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel,
NULL::boolean AS is_ford,
NULL::boolean AS is_ramp, NULL::int AS is_oneway, NULL as man_made,
NULL::int AS layer, NULL::int AS level, NULL::boolean AS indoor,
NULL as bicycle, NULL as foot, NULL as horse, NULL as mtb_scale,
NULL AS surface, z_order
FROM osm_transportation_merge_linestring_gen5
WHERE zoom_level = 6
@@ -82,12 +88,13 @@ indoor INT, surface TEXT) AS $$
-- etldoc: osm_transportation_merge_linestring_gen4 -> layer_transportation:z7
SELECT
osm_id, geometry,
highway, NULL AS railway, NULL AS aerialway, NULL AS shipway,
highway, construction, NULL AS railway, NULL AS aerialway, NULL AS shipway,
NULL AS public_transport, NULL AS service,
NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel,
NULL::boolean AS is_ford,
NULL::boolean AS is_ramp, NULL::int AS is_oneway, NULL as man_made,
NULL::int AS layer, NULL::int AS level, NULL::boolean AS indoor,
NULL as bicycle, NULL as foot, NULL as horse, NULL as mtb_scale,
NULL AS surface, z_order
FROM osm_transportation_merge_linestring_gen4
WHERE zoom_level = 7
@@ -96,12 +103,13 @@ indoor INT, surface TEXT) AS $$
-- etldoc: osm_transportation_merge_linestring_gen3 -> layer_transportation:z8
SELECT
osm_id, geometry,
highway, NULL AS railway, NULL AS aerialway, NULL AS shipway,
highway, construction, NULL AS railway, NULL AS aerialway, NULL AS shipway,
NULL AS public_transport, NULL AS service,
NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel,
NULL::boolean AS is_ford,
NULL::boolean AS is_ramp, NULL::int AS is_oneway, NULL as man_made,
NULL::int AS layer, NULL::int AS level, NULL::boolean AS indoor,
NULL as bicycle, NULL as foot, NULL as horse, NULL as mtb_scale,
NULL AS surface, z_order
FROM osm_transportation_merge_linestring_gen3
WHERE zoom_level = 8
@@ -111,12 +119,13 @@ indoor INT, surface TEXT) AS $$
-- etldoc: osm_highway_linestring_gen2 -> layer_transportation:z10
SELECT
osm_id, geometry,
highway, NULL AS railway, NULL AS aerialway, NULL AS shipway,
highway, construction, NULL AS railway, NULL AS aerialway, NULL AS shipway,
NULL AS public_transport, NULL AS service,
NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel,
NULL::boolean AS is_ford,
NULL::boolean AS is_ramp, NULL::int AS is_oneway, NULL as man_made,
layer, NULL::int AS level, NULL::boolean AS indoor,
bicycle, foot, horse, mtb_scale,
NULL AS surface, z_order
FROM osm_highway_linestring_gen2
WHERE zoom_level BETWEEN 9 AND 10
@@ -126,12 +135,13 @@ indoor INT, surface TEXT) AS $$
-- etldoc: osm_highway_linestring_gen1 -> layer_transportation:z11
SELECT
osm_id, geometry,
highway, NULL AS railway, NULL AS aerialway, NULL AS shipway,
highway, construction, NULL AS railway, NULL AS aerialway, NULL AS shipway,
NULL AS public_transport, NULL AS service,
NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel,
NULL::boolean AS is_ford,
NULL::boolean AS is_ramp, NULL::int AS is_oneway, NULL as man_made,
layer, NULL::int AS level, NULL::boolean AS indoor,
bicycle, foot, horse, mtb_scale,
NULL AS surface, z_order
FROM osm_highway_linestring_gen1
WHERE zoom_level = 11
@@ -143,7 +153,7 @@ indoor INT, surface TEXT) AS $$
-- etldoc: osm_highway_linestring -> layer_transportation:z14_
SELECT
osm_id, geometry,
highway, NULL AS railway, NULL AS aerialway, NULL AS shipway,
highway, construction, NULL AS railway, NULL AS aerialway, NULL AS shipway,
public_transport, service_value(service) AS service,
is_bridge, is_tunnel, is_ford, is_ramp, is_oneway, man_made,
layer,
@@ -153,17 +163,18 @@ indoor INT, surface TEXT) AS $$
CASE WHEN highway IN ('footway', 'steps') THEN indoor
ELSE NULL::boolean
END AS indoor,
bicycle, foot, horse, mtb_scale,
surface_value(surface) AS "surface",
z_order
FROM osm_highway_linestring
WHERE NOT is_area AND (
zoom_level = 12 AND (
highway_class(highway, public_transport) NOT IN ('track', 'path', 'minor')
highway_class(highway, public_transport, construction) NOT IN ('track', 'path', 'minor')
OR highway IN ('unclassified', 'residential')
) AND man_made <> 'pier'
OR zoom_level = 13
AND (
highway_class(highway, public_transport) NOT IN ('track', 'path') AND man_made <> 'pier'
highway_class(highway, public_transport, construction) NOT IN ('track', 'path') AND man_made <> 'pier'
OR
man_made = 'pier' AND NOT ST_IsClosed(geometry)
)
@@ -179,13 +190,14 @@ indoor INT, surface TEXT) AS $$
-- etldoc: osm_railway_linestring_gen5 -> layer_transportation:z8
SELECT
osm_id, geometry,
NULL AS highway, railway, NULL AS aerialway, NULL AS shipway,
NULL AS highway, NULL AS construction, railway, NULL AS aerialway, NULL AS shipway,
NULL AS public_transport, service_value(service) AS service,
NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel,
NULL::boolean AS is_ford,
NULL::boolean AS is_ramp, NULL::int AS is_oneway, NULL as man_made,
NULL::int AS layer, NULL::int AS level, NULL::boolean AS indoor,
NULL as surface, z_order
NULL as bicycle, NULL as foot, NULL as horse, NULL as mtb_scale,
NULL as surface, z_order
FROM osm_railway_linestring_gen5
WHERE zoom_level = 8
AND railway='rail' AND service = '' and usage='main'
@@ -194,13 +206,14 @@ indoor INT, surface TEXT) AS $$
-- etldoc: osm_railway_linestring_gen4 -> layer_transportation:z9
SELECT
osm_id, geometry,
NULL AS highway, railway, NULL AS aerialway, NULL AS shipway,
NULL AS highway, NULL AS construction, railway, NULL AS aerialway, NULL AS shipway,
NULL AS public_transport, service_value(service) AS service,
NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel,
NULL::boolean AS is_ford,
NULL::boolean AS is_ramp, NULL::int AS is_oneway, NULL as man_made,
layer, NULL::int AS level, NULL::boolean AS indoor,
NULL AS surface, z_order
NULL as bicycle, NULL as foot, NULL as horse, NULL as mtb_scale,
NULL AS surface, z_order
FROM osm_railway_linestring_gen4
WHERE zoom_level = 9
AND railway='rail' AND service = '' and usage='main'
@@ -209,10 +222,11 @@ indoor INT, surface TEXT) AS $$
-- etldoc: osm_railway_linestring_gen3 -> layer_transportation:z10
SELECT
osm_id, geometry,
NULL AS highway, railway, NULL AS aerialway, NULL AS shipway,
NULL AS highway, NULL AS construction, railway, NULL AS aerialway, NULL AS shipway,
NULL AS public_transport, service_value(service) AS service,
is_bridge, is_tunnel, is_ford, is_ramp, is_oneway, NULL as man_made,
layer, NULL::int AS level, NULL::boolean AS indoor,
NULL as bicycle, NULL as foot, NULL as horse, NULL as mtb_scale,
NULL AS surface, z_order
FROM osm_railway_linestring_gen3
WHERE zoom_level = 10
@@ -222,10 +236,11 @@ indoor INT, surface TEXT) AS $$
-- etldoc: osm_railway_linestring_gen2 -> layer_transportation:z11
SELECT
osm_id, geometry,
NULL AS highway, railway, NULL AS aerialway, NULL AS shipway,
NULL AS highway, NULL AS construction, railway, NULL AS aerialway, NULL AS shipway,
NULL AS public_transport, service_value(service) AS service,
is_bridge, is_tunnel, is_ford, is_ramp, is_oneway, NULL as man_made,
layer, NULL::int AS level, NULL::boolean AS indoor,
NULL as bicycle, NULL as foot, NULL as horse, NULL as mtb_scale,
NULL as surface, z_order
FROM osm_railway_linestring_gen2
WHERE zoom_level = 11
@@ -235,10 +250,11 @@ indoor INT, surface TEXT) AS $$
-- etldoc: osm_railway_linestring_gen1 -> layer_transportation:z12
SELECT
osm_id, geometry,
NULL AS highway, railway, NULL AS aerialway, NULL AS shipway,
NULL AS highway, NULL AS construction, railway, NULL AS aerialway, NULL AS shipway,
NULL AS public_transport, service_value(service) AS service,
is_bridge, is_tunnel, is_ford, is_ramp, is_oneway, NULL as man_made,
layer, NULL::int AS level, NULL::boolean AS indoor,
NULL as bicycle, NULL as foot, NULL as horse, NULL as mtb_scale,
NULL as surface, z_order
FROM osm_railway_linestring_gen1
WHERE zoom_level = 12
@@ -249,10 +265,11 @@ indoor INT, surface TEXT) AS $$
-- etldoc: osm_railway_linestring -> layer_transportation:z14_
SELECT
osm_id, geometry,
NULL AS highway, railway, NULL AS aerialway, NULL AS shipway,
NULL AS highway, NULL AS construction, railway, NULL AS aerialway, NULL AS shipway,
NULL AS public_transport, service_value(service) AS service,
is_bridge, is_tunnel, is_ford, is_ramp, is_oneway, NULL as man_made,
layer, NULL::int AS level, NULL::boolean AS indoor,
NULL as bicycle, NULL as foot, NULL as horse, NULL as mtb_scale,
NULL as surface, z_order
FROM osm_railway_linestring
WHERE zoom_level = 13
@@ -263,10 +280,11 @@ indoor INT, surface TEXT) AS $$
-- etldoc: osm_aerialway_linestring_gen1 -> layer_transportation:z12
SELECT
osm_id, geometry,
NULL AS highway, NULL as railway, aerialway, NULL AS shipway,
NULL AS highway, NULL AS construction, NULL as railway, aerialway, NULL AS shipway,
NULL AS public_transport, service_value(service) AS service,
is_bridge, is_tunnel, is_ford, is_ramp, is_oneway, NULL as man_made,
layer, NULL::int AS level, NULL::boolean AS indoor,
NULL as bicycle, NULL as foot, NULL as horse, NULL as mtb_scale,
NULL AS surface, z_order
FROM osm_aerialway_linestring_gen1
WHERE zoom_level = 12
@@ -276,10 +294,11 @@ indoor INT, surface TEXT) AS $$
-- etldoc: osm_aerialway_linestring -> layer_transportation:z14_
SELECT
osm_id, geometry,
NULL AS highway, NULL as railway, aerialway, NULL AS shipway,
NULL AS highway, NULL AS construction, NULL as railway, aerialway, NULL AS shipway,
NULL AS public_transport, service_value(service) AS service,
is_bridge, is_tunnel, is_ford, is_ramp, is_oneway, NULL as man_made,
layer, NULL::int AS level, NULL::boolean AS indoor,
NULL as bicycle, NULL as foot, NULL as horse, NULL as mtb_scale,
NULL AS surface, z_order
FROM osm_aerialway_linestring
WHERE zoom_level >= 13
@@ -288,10 +307,11 @@ indoor INT, surface TEXT) AS $$
-- etldoc: osm_shipway_linestring_gen2 -> layer_transportation:z11
SELECT
osm_id, geometry,
NULL AS highway, NULL AS railway, NULL AS aerialway, shipway,
NULL AS highway, NULL AS construction, NULL AS railway, NULL AS aerialway, shipway,
NULL AS public_transport, service_value(service) AS service,
is_bridge, is_tunnel, is_ford, is_ramp, is_oneway, NULL as man_made,
layer, NULL::int AS level, NULL::boolean AS indoor,
NULL as bicycle, NULL as foot, NULL as horse, NULL as mtb_scale,
NULL AS surface, z_order
FROM osm_shipway_linestring_gen2
WHERE zoom_level = 11
@@ -300,10 +320,11 @@ indoor INT, surface TEXT) AS $$
-- etldoc: osm_shipway_linestring_gen1 -> layer_transportation:z12
SELECT
osm_id, geometry,
NULL AS highway, NULL AS railway, NULL AS aerialway, shipway,
NULL AS highway, NULL AS construction, NULL AS railway, NULL AS aerialway, shipway,
NULL AS public_transport, service_value(service) AS service,
is_bridge, is_tunnel, is_ford, is_ramp, is_oneway, NULL as man_made,
layer, NULL::int AS level, NULL::boolean AS indoor,
NULL as bicycle, NULL as foot, NULL as horse, NULL as mtb_scale,
NULL AS surface, z_order
FROM osm_shipway_linestring_gen1
WHERE zoom_level = 12
@@ -313,10 +334,11 @@ indoor INT, surface TEXT) AS $$
-- etldoc: osm_shipway_linestring -> layer_transportation:z14_
SELECT
osm_id, geometry,
NULL AS highway, NULL AS railway, NULL AS aerialway, shipway,
NULL AS highway, NULL AS construction, NULL AS railway, NULL AS aerialway, shipway,
NULL AS public_transport, service_value(service) AS service,
is_bridge, is_tunnel, is_ford, is_ramp, is_oneway, NULL as man_made,
layer, NULL::int AS level, NULL::boolean AS indoor,
NULL as bicycle, NULL as foot, NULL as horse, NULL as mtb_scale,
NULL AS surface, z_order
FROM osm_shipway_linestring
WHERE zoom_level >= 13
@@ -330,13 +352,14 @@ indoor INT, surface TEXT) AS $$
-- etldoc: osm_highway_polygon -> layer_transportation:z14_
SELECT
osm_id, geometry,
highway, NULL AS railway, NULL AS aerialway, NULL AS shipway,
highway, NULL AS construction, NULL AS railway, NULL AS aerialway, NULL AS shipway,
public_transport, NULL AS service,
CASE WHEN man_made IN ('bridge') THEN TRUE
ELSE FALSE
END AS is_bridge, FALSE AS is_tunnel, FALSE AS is_ford,
FALSE AS is_ramp, FALSE::int AS is_oneway, man_made,
layer, NULL::int AS level, NULL::boolean AS indoor,
NULL as bicycle, NULL as foot, NULL as horse, NULL as mtb_scale,
NULL AS surface, z_order
FROM osm_highway_polygon
-- We do not want underground pedestrian areas for now

View File

@@ -45,13 +45,13 @@ generalized_tables:
# etldoc: imposm3 -> osm_highway_linestring_gen2
highway_linestring_gen2:
source: highway_linestring_gen1
sql_filter: highway IN ('motorway', 'trunk', 'primary', 'secondary', 'motorway_link', 'trunk_link', 'primary_link', 'secondary_link') AND NOT is_area
sql_filter: (highway IN ('motorway', 'trunk', 'primary', 'secondary', 'motorway_link', 'trunk_link', 'primary_link', 'secondary_link') OR highway = 'construction' AND construction IN ('motorway', 'trunk', 'primary', 'secondary', 'motorway_link', 'trunk_link', 'primary_link', 'secondary_link')) AND NOT is_area
tolerance: ZRES11
# etldoc: imposm3 -> osm_highway_linestring_gen1
highway_linestring_gen1:
source: highway_linestring
sql_filter: highway IN ('motorway', 'trunk', 'primary', 'secondary', 'tertiary', 'motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary_link') AND NOT is_area AND ST_IsValid(geometry)
sql_filter: (highway IN ('motorway', 'trunk', 'primary', 'secondary', 'tertiary', 'motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary_link') OR highway = 'construction' AND construction IN ('motorway', 'trunk', 'primary', 'secondary', 'tertiary', 'motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary_link')) AND NOT is_area AND ST_IsValid(geometry)
tolerance: ZRES12
name_field: &name
@@ -133,6 +133,22 @@ man_made_field: &man_made
z_order_field: &z_order
name: z_order
type: wayzorder
bicycle_field: &bicycle
key: bicycle
name: bicycle
type: string
foot_field: &foot
key: foot
name: foot
type: string
horse_field: &horse
key: horse
name: horse
type: string
mtb_scale_field: &mtb_scale
key: mtb:scale
name: mtb_scale
type: string
surface_field: &surface
key: surface
name: surface
@@ -150,6 +166,9 @@ tables:
- name: highway
key: highway
type: string
- name: construction
key: construction
type: string
- *ref
- *network
- *z_order
@@ -172,6 +191,10 @@ tables:
- *usage
- *public_transport
- *man_made
- *bicycle
- *foot
- *horse
- *mtb_scale
- *surface
mapping:
highway:
@@ -187,18 +210,19 @@ tables:
- tertiary_link
- unclassified
- residential
- road
- living_street
- raceway
- track
- service
- path
- cycleway
- bridleway
- footway
- corridor
- road
- pedestrian
- path
- footway
- cycleway
- steps
- bridleway
- corridor
- service
- track
- raceway
- construction
public_transport:
- platform
man_made:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 114 KiB

View File

@@ -14,9 +14,10 @@ layer:
fields:
class:
description: |
Distinguish between more and less important roads or railways.
Distinguish between more and less important roads or railways and roads under construction.
Class is derived from the value of the
[`highway`](http://wiki.openstreetmap.org/wiki/Key:highway),
[`construction`](http://wiki.openstreetmap.org/wiki/Key:construction),
[`railway`](http://wiki.openstreetmap.org/wiki/Key:railway),
[`aerialway`](http://wiki.openstreetmap.org/wiki/Key:aerialway),
[`route`](http://wiki.openstreetmap.org/wiki/Key:route) tag (for
@@ -33,6 +34,16 @@ layer:
- 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
@@ -95,17 +106,29 @@ layer:
- parking_aisle
layer:
description: |
Original value of [`layer`](http://wiki.openstreetmap.org/wiki/Key:layer) tag.
Original value of the [`layer`](http://wiki.openstreetmap.org/wiki/Key:layer) tag.
level:
description: |
Experimental feature! Filled only for steps and footways. Original
value of [`level`](http://wiki.openstreetmap.org/wiki/Key:level) tag.
value of the [`level`](http://wiki.openstreetmap.org/wiki/Key:level) tag.
indoor:
description: |
Experimental feature! Filled only for steps and footways. Original
value of [`indoor`](http://wiki.openstreetmap.org/wiki/Key:indoor) tag.
value of the [`indoor`](http://wiki.openstreetmap.org/wiki/Key:indoor) tag.
values:
- 1
bicycle:
description: |
Original value of the [`bicycle`](http://wiki.openstreetmap.org/wiki/Key:bicycle) tag (highways only).
foot:
description: |
Original value of the [`foot`](http://wiki.openstreetmap.org/wiki/Key:foot) tag (highways only).
horse:
description: |
Original value of the [`horse`](http://wiki.openstreetmap.org/wiki/Key:horse) tag (highways only).
mtb_scale:
description: |
Original value of the [`mtb:scale`](http://wiki.openstreetmap.org/wiki/Key:mtb:scale) tag (highways only).
surface:
description: |
Values of [`surface`](https://wiki.openstreetmap.org/wiki/Key:surface) tag devided into 2 groups `paved` (paved, asphalt, cobblestone, concrete, concrete:lanes, concrete:plates, metal, paving_stones, sett, unhewn_cobblestone, wood) and `unpaved` (unpaved, compacted, dirt, earth, fine_gravel, grass, grass_paver, gravel, gravel_turf, ground, ice, mud, pebblestone, salt, sand, snow, woodchips).
@@ -115,7 +138,7 @@ layer:
datasource:
geometry_field: geometry
srid: 900913
query: (SELECT geometry, class, subclass, oneway, ramp, brunnel, service, layer, level, indoor, surface FROM layer_transportation(!bbox!, z(!scale_denominator!))) AS t
query: (SELECT geometry, class, subclass, oneway, ramp, brunnel, service, layer, level, indoor, bicycle, foot, horse, mtb_scale, surface FROM layer_transportation(!bbox!, z(!scale_denominator!))) AS t
schema:
- ./class.sql
- ./update_transportation_merge.sql

View File

@@ -22,84 +22,88 @@ CREATE INDEX IF NOT EXISTS osm_highway_linestring_highway_idx
-- Improve performance of the sql below
CREATE INDEX IF NOT EXISTS osm_highway_linestring_highway_partial_idx
ON osm_highway_linestring(highway)
WHERE highway IN ('motorway','trunk', 'primary');
WHERE highway IN ('motorway','trunk', 'primary', 'construction');
-- etldoc: osm_highway_linestring -> osm_transportation_merge_linestring
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring AS (
SELECT
(ST_Dump(geometry)).geom AS geometry,
NULL::bigint AS osm_id,
highway,
highway, construction,
z_order
FROM (
SELECT
ST_LineMerge(ST_Collect(geometry)) AS geometry,
highway,
highway, construction,
min(z_order) AS z_order
FROM osm_highway_linestring
WHERE highway IN ('motorway','trunk', 'primary') AND ST_IsValid(geometry)
group by highway
WHERE (highway IN ('motorway','trunk', 'primary') OR highway = 'construction' AND construction IN ('motorway','trunk', 'primary'))
AND ST_IsValid(geometry)
group by highway, construction
) AS highway_union
);
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
ON osm_transportation_merge_linestring(highway)
WHERE highway IN ('motorway','trunk', 'primary');
ON osm_transportation_merge_linestring(highway, construction)
WHERE highway IN ('motorway','trunk', 'primary', 'construction');
-- etldoc: osm_transportation_merge_linestring -> osm_transportation_merge_linestring_gen3
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen3 AS (
SELECT ST_Simplify(geometry, 120) AS geometry, osm_id, highway, z_order
SELECT ST_Simplify(geometry, 120) AS geometry, osm_id, highway, construction, z_order
FROM osm_transportation_merge_linestring
WHERE highway IN ('motorway','trunk', 'primary')
OR highway = 'construction' AND construction IN ('motorway','trunk', 'primary')
);
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
ON osm_transportation_merge_linestring_gen3(highway)
WHERE highway IN ('motorway','trunk', 'primary');
ON osm_transportation_merge_linestring_gen3(highway, construction)
WHERE highway IN ('motorway','trunk', 'primary', 'construction');
-- etldoc: osm_transportation_merge_linestring_gen3 -> osm_transportation_merge_linestring_gen4
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen4 AS (
SELECT ST_Simplify(geometry, 200) AS geometry, osm_id, highway, z_order
SELECT ST_Simplify(geometry, 200) AS geometry, osm_id, highway, construction, z_order
FROM osm_transportation_merge_linestring_gen3
WHERE highway IN ('motorway','trunk', 'primary') AND ST_Length(geometry) > 50
WHERE (highway IN ('motorway','trunk', 'primary') OR highway = 'construction' AND construction IN ('motorway','trunk', 'primary'))
AND ST_Length(geometry) > 50
);
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
ON osm_transportation_merge_linestring_gen4(highway)
WHERE highway IN ('motorway','trunk', 'primary');
ON osm_transportation_merge_linestring_gen4(highway, construction)
WHERE highway IN ('motorway','trunk', 'primary', 'construction');
-- etldoc: osm_transportation_merge_linestring_gen4 -> osm_transportation_merge_linestring_gen5
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen5 AS (
SELECT ST_Simplify(geometry, 500) AS geometry, osm_id, highway, z_order
SELECT ST_Simplify(geometry, 500) AS geometry, osm_id, highway, construction, z_order
FROM osm_transportation_merge_linestring_gen4
WHERE highway IN ('motorway','trunk') AND ST_Length(geometry) > 100
WHERE (highway IN ('motorway','trunk') OR highway = 'construction' AND construction IN ('motorway','trunk'))
AND ST_Length(geometry) > 100
);
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
ON osm_transportation_merge_linestring_gen5(highway)
WHERE highway IN ('motorway', 'trunk');
ON osm_transportation_merge_linestring_gen5(highway, construction)
WHERE highway IN ('motorway','trunk', 'construction');
-- etldoc: osm_transportation_merge_linestring_gen5 -> osm_transportation_merge_linestring_gen6
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen6 AS (
SELECT ST_Simplify(geometry, 1000) AS geometry, osm_id, highway, z_order
SELECT ST_Simplify(geometry, 1000) AS geometry, osm_id, highway, construction, z_order
FROM osm_transportation_merge_linestring_gen5
WHERE highway IN ('motorway','trunk') AND ST_Length(geometry) > 500
WHERE (highway IN ('motorway','trunk') OR highway = 'construction' AND construction IN ('motorway','trunk')) AND ST_Length(geometry) > 500
);
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
ON osm_transportation_merge_linestring_gen6(highway)
WHERE highway IN ('motorway','trunk');
ON osm_transportation_merge_linestring_gen6(highway, construction)
WHERE highway IN ('motorway','trunk', 'construction');
-- etldoc: osm_transportation_merge_linestring_gen6 -> osm_transportation_merge_linestring_gen7
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen7 AS (
SELECT ST_Simplify(geometry, 2000) AS geometry, osm_id, highway, z_order
SELECT ST_Simplify(geometry, 2000) AS geometry, osm_id, highway, construction, z_order
FROM osm_transportation_merge_linestring_gen6
WHERE highway IN ('motorway') AND ST_Length(geometry) > 1000
WHERE (highway = 'motorway' OR highway = 'construction' AND construction = 'motorway') AND ST_Length(geometry) > 1000
);
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen7_geometry_idx
ON osm_transportation_merge_linestring_gen7 USING gist(geometry);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 299 KiB

After

Width:  |  Height:  |  Size: 334 KiB

View File

@@ -19,9 +19,9 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text,
when length(coalesce(ref, ''))>0
then 'road'
end as network,
highway_class(highway, '') AS class,
highway_class(highway, '', construction) AS class,
CASE
WHEN highway IS NOT NULL AND highway_class(highway, '') = 'path'
WHEN highway IS NOT NULL AND highway_class(highway, '', construction) = 'path'
THEN highway
ELSE NULL
END AS subclass,
@@ -70,6 +70,7 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text,
"tags",
ref,
highway,
construction,
network,
z_order,
layer,
@@ -78,7 +79,7 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text,
FROM osm_transportation_name_linestring
WHERE zoom_level = 12
AND LineLabel(zoom_level, COALESCE(NULLIF(name, ''), ref), geometry)
AND highway_class(highway, '') NOT IN ('minor', 'track', 'path')
AND highway_class(highway, '', construction) NOT IN ('minor', 'track', 'path')
AND NOT highway_is_link(highway)
UNION ALL
@@ -92,6 +93,7 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text,
"tags",
ref,
highway,
construction,
network,
z_order,
layer,
@@ -100,7 +102,7 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text,
FROM osm_transportation_name_linestring
WHERE zoom_level = 13
AND LineLabel(zoom_level, COALESCE(NULLIF(name, ''), ref), geometry)
AND highway_class(highway, '') NOT IN ('track', 'path')
AND highway_class(highway, '', construction) NOT IN ('track', 'path')
UNION ALL
-- etldoc: osm_transportation_name_linestring -> layer_transportation_name:z14_
@@ -113,6 +115,7 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text,
"tags",
ref,
highway,
construction,
network,
z_order,
layer,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 114 KiB

View File

@@ -29,7 +29,7 @@ layer:
- road (default)
class:
description: |
Distinguish between more and less important roads.
Distinguish between more and less important roads and roads under construction.
values:
- motorway
- trunk
@@ -41,6 +41,16 @@ layer:
- 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
subclass:

View File

@@ -8,14 +8,14 @@ BEGIN
select st_buffer(geometry, 10000) into gbr_geom from ne_10m_admin_0_countries where iso_a2 = 'GB';
delete from osm_route_member where network IN('omt-gb-motorway', 'omt-gb-trunk');
insert into osm_route_member (member, ref, network)
insert into osm_route_member (osm_id, member, ref, network)
(
SELECT hw.osm_id, substring(hw.ref from E'^[AM][0-9AM()]+'), 'omt-gb-motorway'
SELECT 0, hw.osm_id, substring(hw.ref from E'^[AM][0-9AM()]+'), 'omt-gb-motorway'
from osm_highway_linestring hw
where length(hw.ref)>0 and ST_Intersects(hw.geometry, gbr_geom)
and hw.highway IN ('motorway')
) UNION (
SELECT hw.osm_id, substring(hw.ref from E'^[AM][0-9AM()]+'), 'omt-gb-trunk'
SELECT 0, hw.osm_id, substring(hw.ref from E'^[AM][0-9AM()]+'), 'omt-gb-trunk'
from osm_highway_linestring hw
where length(hw.ref)>0 and ST_Intersects(hw.geometry, gbr_geom)
and hw.highway IN ('trunk')

View File

@@ -24,6 +24,7 @@ CREATE MATERIALIZED VIEW osm_transportation_name_network AS (
else hl.ref
end as ref,
hl.highway,
hl.construction,
CASE WHEN highway IN ('footway', 'steps') THEN layer
ELSE NULL::int
END AS layer,
@@ -53,6 +54,7 @@ CREATE MATERIALIZED VIEW osm_transportation_name_linestring AS (
tags || get_basic_names(tags, geometry) AS "tags",
ref,
highway,
construction,
"level",
layer,
indoor,
@@ -68,6 +70,7 @@ CREATE MATERIALIZED VIEW osm_transportation_name_linestring AS (
AS "tags",
ref,
highway,
construction,
"level",
layer,
indoor,
@@ -77,56 +80,56 @@ CREATE MATERIALIZED VIEW osm_transportation_name_linestring AS (
WHERE ("rank"=1 OR "rank" is null)
AND (name <> '' OR ref <> '')
AND NULLIF(highway, '') IS NOT NULL
group by name, name_en, name_de, ref, highway, "level", layer, indoor, network_type
group by name, name_en, name_de, ref, highway, construction, "level", layer, indoor, network_type
) AS highway_union
);
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
ON osm_transportation_name_linestring(highway)
WHERE highway IN ('motorway','trunk');
ON osm_transportation_name_linestring(highway, construction)
WHERE highway IN ('motorway','trunk', 'construction');
-- etldoc: osm_transportation_name_linestring -> osm_transportation_name_linestring_gen1
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, network, z_order
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') AND ST_Length(geometry) > 8000
WHERE (highway IN ('motorway','trunk') OR highway = 'construction' AND construction IN ('motorway','trunk')) AND ST_Length(geometry) > 8000
);
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
ON osm_transportation_name_linestring_gen1(highway)
WHERE highway IN ('motorway','trunk');
ON osm_transportation_name_linestring_gen1(highway, construction)
WHERE highway IN ('motorway','trunk', 'construction');
-- etldoc: osm_transportation_name_linestring_gen1 -> osm_transportation_name_linestring_gen2
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, network, z_order
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') AND ST_Length(geometry) > 14000
WHERE (highway IN ('motorway','trunk') OR highway = 'construction' AND construction IN ('motorway','trunk')) AND ST_Length(geometry) > 14000
);
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
ON osm_transportation_name_linestring_gen2(highway)
WHERE highway = 'motorway';
ON osm_transportation_name_linestring_gen2(highway, construction)
WHERE highway IN ('motorway','trunk', 'construction');
-- etldoc: osm_transportation_name_linestring_gen2 -> osm_transportation_name_linestring_gen3
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, network, z_order
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' AND ST_Length(geometry) > 20000
WHERE (highway = 'motorway' OR highway = 'construction' AND construction = 'motorway') AND ST_Length(geometry) > 20000
);
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
ON osm_transportation_name_linestring_gen3(highway)
WHERE highway = 'motorway';
ON osm_transportation_name_linestring_gen3(highway, construction)
WHERE highway IN ('motorway', 'construction');
-- etldoc: osm_transportation_name_linestring_gen3 -> osm_transportation_name_linestring_gen4
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, network, z_order
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' AND ST_Length(geometry) > 20000
WHERE (highway = 'motorway' OR highway = 'construction' AND construction = 'motorway') AND ST_Length(geometry) > 20000
);
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen4_geometry_idx ON osm_transportation_name_linestring_gen4 USING gist(geometry);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 KiB

After

Width:  |  Height:  |  Size: 275 KiB

View File

@@ -36,6 +36,15 @@ generalized_tables:
sql_filter: area>power(ZRES10,2) AND ST_IsValid(geometry)
tolerance: ZRES12
tunnel_field: &tunnel
key: tunnel
name: is_tunnel
type: bool
bridge_field: &bridge
key: bridge
name: is_bridge
type: bool
tables:
# etldoc: imposm3 -> osm_water_polygon
@@ -72,6 +81,8 @@ tables:
- name: is_intermittent
key: intermittent
type: bool
- *tunnel
- *bridge
filters:
reject:
covered: ["yes"]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -8,125 +8,160 @@ CREATE OR REPLACE FUNCTION water_class(waterway TEXT) RETURNS TEXT AS $$
$$ LANGUAGE SQL IMMUTABLE;
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;
CREATE OR REPLACE VIEW water_z0 AS (
-- etldoc: ne_110m_ocean -> water_z0
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent FROM ne_110m_ocean
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel
FROM ne_110m_ocean
UNION ALL
-- etldoc: ne_110m_lakes -> water_z0
SELECT geometry, 'lake'::text AS class, NULL::boolean AS is_intermittent FROM ne_110m_lakes
SELECT geometry, 'lake'::text AS class, NULL::boolean AS is_intermittent, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel
FROM ne_110m_lakes
);
CREATE OR REPLACE VIEW water_z1 AS (
-- etldoc: ne_110m_ocean -> water_z1
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent FROM ne_110m_ocean
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel
FROM ne_110m_ocean
UNION ALL
-- etldoc: ne_110m_lakes -> water_z1
SELECT geometry, 'lake'::text AS class, NULL::boolean AS is_intermittent FROM ne_110m_lakes
SELECT geometry, 'lake'::text AS class, NULL::boolean AS is_intermittent, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel
FROM ne_110m_lakes
);
CREATE OR REPLACE VIEW water_z2 AS (
-- etldoc: ne_50m_ocean -> water_z2
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent FROM ne_50m_ocean
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel
FROM ne_50m_ocean
UNION ALL
-- etldoc: ne_50m_lakes -> water_z2
SELECT geometry, 'lake'::text AS class, NULL::boolean AS is_intermittent FROM ne_50m_lakes
SELECT geometry, 'lake'::text AS class, NULL::boolean AS is_intermittent, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel
FROM ne_50m_lakes
);
CREATE OR REPLACE VIEW water_z4 AS (
-- etldoc: ne_50m_ocean -> water_z4
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent FROM ne_50m_ocean
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel
FROM ne_50m_ocean
UNION ALL
-- etldoc: ne_50m_lakes -> water_z4
SELECT geometry, 'lake'::text AS class, NULL::boolean AS is_intermittent FROM ne_50m_lakes
SELECT geometry, 'lake'::text AS class, NULL::boolean AS is_intermittent, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel
FROM ne_50m_lakes
);
CREATE OR REPLACE VIEW water_z5 AS (
-- etldoc: ne_10m_ocean -> water_z5
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent FROM ne_10m_ocean
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel
FROM ne_10m_ocean
UNION ALL
-- etldoc: ne_10m_lakes -> water_z5
SELECT geometry, 'lake'::text AS class, NULL::boolean AS is_intermittent FROM ne_10m_lakes
SELECT geometry, 'lake'::text AS class, NULL::boolean AS is_intermittent, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel
FROM ne_10m_lakes
);
CREATE OR REPLACE VIEW water_z6 AS (
-- etldoc: ne_10m_ocean -> water_z6
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent FROM ne_10m_ocean
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel
FROM ne_10m_ocean
UNION ALL
-- etldoc: osm_water_polygon_gen6 -> water_z6
SELECT geometry, water_class(waterway) AS class, is_intermittent FROM osm_water_polygon_gen6
SELECT geometry, water_class(waterway) AS class, is_intermittent, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel
FROM osm_water_polygon_gen6
WHERE "natural" != 'bay'
);
CREATE OR REPLACE VIEW water_z7 AS (
-- etldoc: ne_10m_ocean -> water_z7
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent FROM ne_10m_ocean
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel
FROM ne_10m_ocean
UNION ALL
-- etldoc: osm_water_polygon_gen5 -> water_z7
SELECT geometry, water_class(waterway) AS class, is_intermittent FROM osm_water_polygon_gen5
SELECT geometry, water_class(waterway) AS class, is_intermittent, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel
FROM osm_water_polygon_gen5
WHERE "natural" != 'bay'
);
CREATE OR REPLACE VIEW water_z8 AS (
-- etldoc: osm_ocean_polygon_gen4 -> water_z8
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent FROM osm_ocean_polygon_gen4
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel
FROM osm_ocean_polygon_gen4
UNION ALL
-- etldoc: osm_water_polygon_gen4 -> water_z8
SELECT geometry, water_class(waterway) AS class, is_intermittent FROM osm_water_polygon_gen4
SELECT geometry, water_class(waterway) AS class, is_intermittent, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel
FROM osm_water_polygon_gen4
WHERE "natural" != 'bay'
);
CREATE OR REPLACE VIEW water_z9 AS (
-- etldoc: osm_ocean_polygon_gen3 -> water_z9
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent FROM osm_ocean_polygon_gen3
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel
FROM osm_ocean_polygon_gen3
UNION ALL
-- etldoc: osm_water_polygon_gen3 -> water_z9
SELECT geometry, water_class(waterway) AS class, is_intermittent FROM osm_water_polygon_gen3
SELECT geometry, water_class(waterway) AS class, is_intermittent, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel FROM osm_water_polygon_gen3
WHERE "natural" != 'bay'
);
CREATE OR REPLACE VIEW water_z10 AS (
-- etldoc: osm_ocean_polygon_gen2 -> water_z10
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent FROM osm_ocean_polygon_gen2
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel
FROM osm_ocean_polygon_gen2
UNION ALL
-- etldoc: osm_water_polygon_gen2 -> water_z10
SELECT geometry, water_class(waterway) AS class, is_intermittent FROM osm_water_polygon_gen2
SELECT geometry, water_class(waterway) AS class, is_intermittent, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel FROM osm_water_polygon_gen2
WHERE "natural" != 'bay'
);
CREATE OR REPLACE VIEW water_z11 AS (
-- etldoc: osm_ocean_polygon_gen1 -> water_z11
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent FROM osm_ocean_polygon_gen1
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel
FROM osm_ocean_polygon_gen1
UNION ALL
-- etldoc: osm_water_polygon_gen1 -> water_z11
SELECT geometry, water_class(waterway) AS class, is_intermittent FROM osm_water_polygon_gen1
SELECT geometry, water_class(waterway) AS class, is_intermittent, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel
FROM osm_water_polygon_gen1
WHERE "natural" != 'bay'
);
CREATE OR REPLACE VIEW water_z12 AS (
-- etldoc: osm_ocean_polygon_gen1 -> water_z12
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent FROM osm_ocean_polygon
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel
FROM osm_ocean_polygon
UNION ALL
-- etldoc: osm_water_polygon -> water_z12
SELECT geometry, water_class(waterway) AS class, is_intermittent FROM osm_water_polygon
SELECT geometry, water_class(waterway) AS class, is_intermittent, is_bridge, is_tunnel
FROM osm_water_polygon
WHERE "natural" != 'bay'
);
CREATE OR REPLACE VIEW water_z13 AS (
-- etldoc: osm_ocean_polygon -> water_z13
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent FROM osm_ocean_polygon
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel
FROM osm_ocean_polygon
UNION ALL
-- etldoc: osm_water_polygon -> water_z13
SELECT geometry, water_class(waterway) AS class, is_intermittent FROM osm_water_polygon
SELECT geometry, water_class(waterway) AS class, is_intermittent, is_bridge, is_tunnel
FROM osm_water_polygon
WHERE "natural" != 'bay'
);
CREATE OR REPLACE VIEW water_z14 AS (
-- etldoc: osm_ocean_polygon -> water_z14
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent FROM osm_ocean_polygon
SELECT geometry, 'ocean'::text AS class, NULL::boolean AS is_intermittent, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel
FROM osm_ocean_polygon
UNION ALL
-- etldoc: osm_water_polygon -> water_z14
SELECT geometry, water_class(waterway) AS class, is_intermittent FROM osm_water_polygon
SELECT geometry, water_class(waterway) AS class, is_intermittent, is_bridge, is_tunnel
FROM osm_water_polygon
WHERE "natural" != 'bay'
);
@@ -134,8 +169,11 @@ CREATE OR REPLACE VIEW water_z14 AS (
-- etldoc: label="layer_water |<z0> z0|<z1>z1|<z2>z2|<z3>z3 |<z4> z4|<z5>z5|<z6>z6|<z7>z7| <z8> z8 |<z9> z9 |<z10> z10 |<z11> z11 |<z12> z12|<z13> z13|<z14_> z14+" ] ;
CREATE OR REPLACE FUNCTION layer_water (bbox geometry, zoom_level int)
RETURNS TABLE(geometry geometry, class text, intermittent int) AS $$
SELECT geometry, class::text, is_intermittent::int AS intermittent FROM (
RETURNS TABLE(geometry geometry, class text, brunnel text, intermittent int) AS $$
SELECT geometry, class::text,
waterway_brunnel(is_bridge, is_tunnel) AS brunnel,
is_intermittent::int AS intermittent
FROM (
-- etldoc: water_z0 -> layer_water:z0
SELECT * FROM water_z0 WHERE zoom_level = 0
UNION ALL

View File

@@ -23,7 +23,7 @@ layer:
values: [0, 1]
buffer_size: 4
datasource:
query: (SELECT geometry, class, intermittent FROM layer_water(!bbox!, z(!scale_denominator!))) AS t
query: (SELECT geometry, class, intermittent, brunnel FROM layer_water(!bbox!, z(!scale_denominator!))) AS t
schema:
- ./water.sql
datasources:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 KiB

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB