From 35b6951c81f7c2c152f137536d31edd7789e87cb Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Sat, 26 Nov 2016 20:19:43 +0000 Subject: [PATCH] Move highway and railway into transportation --- Makefile | 12 ++-- layers/highway_name/layer.sql | 50 --------------- layers/highway_name/merge_highways.sql | 57 ------------------ layers/railway/README.md | 19 ------ layers/railway/mapping | 14 ----- layers/railway/mapping.png | Bin 13139 -> 0 bytes layers/railway/mapping.yaml | 34 ----------- layers/railway/railway.sql | 35 ----------- layers/railway/railway.yaml | 25 -------- layers/railway/types.sql | 15 ----- layers/{highway => transportation}/README.md | 0 .../{highway => transportation}/highway.sql | 46 +++++++------- layers/transportation/mapping | 39 ++++++++++++ .../{highway => transportation}/mapping.png | Bin .../{highway => transportation}/mapping.yaml | 51 +++++++++++----- .../ne_global_roads.sql | 0 .../transportation.yaml} | 4 +- layers/{highway => transportation}/types.sql | 0 .../README.md | 0 layers/transportation_name/layer.sql | 50 +++++++++++++++ layers/transportation_name/merge_highways.sql | 57 ++++++++++++++++++ .../transportation_name.yaml} | 6 +- openmaptiles.yaml | 5 +- 23 files changed, 216 insertions(+), 303 deletions(-) delete mode 100644 layers/highway_name/layer.sql delete mode 100644 layers/highway_name/merge_highways.sql delete mode 100644 layers/railway/README.md delete mode 100644 layers/railway/mapping delete mode 100644 layers/railway/mapping.png delete mode 100644 layers/railway/mapping.yaml delete mode 100644 layers/railway/railway.sql delete mode 100644 layers/railway/railway.yaml delete mode 100644 layers/railway/types.sql rename layers/{highway => transportation}/README.md (100%) rename layers/{highway => transportation}/highway.sql (63%) create mode 100644 layers/transportation/mapping rename layers/{highway => transportation}/mapping.png (100%) rename layers/{highway => transportation}/mapping.yaml (66%) rename layers/{highway => transportation}/ne_global_roads.sql (100%) rename layers/{highway/highway.yaml => transportation/transportation.yaml} (96%) rename layers/{highway => transportation}/types.sql (100%) rename layers/{highway_name => transportation_name}/README.md (100%) create mode 100644 layers/transportation_name/layer.sql create mode 100644 layers/transportation_name/merge_highways.sql rename layers/{highway_name/highway_name.yaml => transportation_name/transportation_name.yaml} (90%) diff --git a/Makefile b/Makefile index ca51ae4..0cf6d7b 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ all: build/openmaptiles.tm2source/data.yml build/mapping.yaml build/tileset.sql .PHONY: docs -docs: layers/railway/README.md layers/boundary/README.md layers/water/README.md layers/building/README.md layers/highway/README.md layers/highway_name/README.md layers/poi/README.md layers/place/README.md layers/waterway/README.md layers/water_name/README.md layers/landcover/README.md layers/landuse/README.md layers/housenumber/README.md +docs: layers/railway/README.md layers/boundary/README.md layers/water/README.md layers/building/README.md layers/transportation/README.md layers/transportation_name/README.md layers/poi/README.md layers/place/README.md layers/waterway/README.md layers/water_name/README.md layers/landcover/README.md layers/landuse/README.md layers/housenumber/README.md build/openmaptiles.tm2source/data.yml: mkdir -p build/openmaptiles.tm2source && generate-tm2source openmaptiles.yaml --host="postgres" --port=5432 --database="openmaptiles" --user="openmaptiles" --password="openmaptiles" > build/openmaptiles.tm2source/data.yml @@ -15,11 +15,11 @@ build/tileset.sql: layers/poi/README.md: generate-doc layers/poi/poi.yaml --diagram layers/poi/mapping > layers/poi/README.md -layers/highway/README.md: - generate-doc layers/highway/highway.yaml --diagram layers/highway/mapping > layers/highway/README.md +layers/transportation/README.md: + generate-doc layers/transportation/transportation.yaml --diagram layers/transportation/mapping > layers/transportation/README.md -layers/highway_name/README.md: - generate-doc layers/highway_name/highway_name.yaml > layers/highway_name/README.md +layers/transportation_name/README.md: + generate-doc layers/transportation_name/transportation_name.yaml > layers/transportation_name/README.md layers/railway/README.md: generate-doc layers/railway/railway.yaml --diagram layers/railway/mapping > layers/railway/README.md @@ -52,4 +52,4 @@ layers/housenumber/README.md: generate-doc layers/housenumber/housenumber.yaml > layers/housenumber/README.md clean: - rm -f build/openmaptiles.tm2source/data.yml && rm -f build/mapping.yaml && rm -f build/tileset.sql && rm -f layers/**/README.md&& rm -f layers/**/*.png + rm -f build/openmaptiles.tm2source/data.yml && rm -f build/mapping.yaml && rm -f build/tileset.sql diff --git a/layers/highway_name/layer.sql b/layers/highway_name/layer.sql deleted file mode 100644 index 100b1fc..0000000 --- a/layers/highway_name/layer.sql +++ /dev/null @@ -1,50 +0,0 @@ - --- etldoc: layer_highway_name[shape=record fillcolor=lightpink, style="rounded,filled", --- etldoc: label="layer_highway_name | z8 | z9 | z10 | z11 | z12| z13| z14_" ] ; - -CREATE OR REPLACE FUNCTION layer_highway_name(bbox geometry, zoom_level integer) -RETURNS TABLE(osm_id bigint, geometry geometry, name text, ref text, ref_length int, class highway_class, subclass text) AS $$ - SELECT osm_id, geometry, name, - NULLIF(ref, ''), NULLIF(LENGTH(ref), 0) AS ref_length, - to_highway_class(highway) AS class, highway AS subclass - FROM ( - - -- etldoc: osm_highway_name_linestring_gen3 -> layer_highway_name:z8 - SELECT * FROM osm_highway_name_linestring_gen3 - WHERE zoom_level = 8 - UNION ALL - - -- etldoc: osm_highway_name_linestring_gen2 -> layer_highway_name:z9 - SELECT * FROM osm_highway_name_linestring_gen2 - WHERE zoom_level = 9 - UNION ALL - - -- etldoc: osm_highway_name_linestring_gen1 -> layer_highway_name:z10 - -- etldoc: osm_highway_name_linestring_gen1 -> layer_highway_name:z11 - SELECT * FROM osm_highway_name_linestring_gen1 - WHERE zoom_level BETWEEN 10 AND 11 - UNION ALL - - -- etldoc: osm_highway_name_linestring -> layer_highway_name:z12 - SELECT * FROM osm_highway_name_linestring - WHERE zoom_level = 12 - AND LineLabel(zoom_level, COALESCE(NULLIF(name, ''), ref), geometry) - AND to_highway_class(highway) < 'minor_road'::highway_class - AND NOT highway_is_link(highway) - UNION ALL - - -- etldoc: osm_highway_name_linestring -> layer_highway_name:z13 - SELECT * FROM osm_highway_name_linestring - WHERE zoom_level = 13 - AND LineLabel(zoom_level, COALESCE(NULLIF(name, ''), ref), geometry) - AND to_highway_class(highway) < 'path'::highway_class - UNION ALL - - -- etldoc: osm_highway_name_linestring -> layer_highway_name:z14_ - SELECT * FROM osm_highway_name_linestring - WHERE zoom_level >= 14 - - ) AS zoom_levels - WHERE geometry && bbox - ORDER BY z_order ASC; -$$ LANGUAGE SQL IMMUTABLE; diff --git a/layers/highway_name/merge_highways.sql b/layers/highway_name/merge_highways.sql deleted file mode 100644 index a96f6d1..0000000 --- a/layers/highway_name/merge_highways.sql +++ /dev/null @@ -1,57 +0,0 @@ --- Instead of using relations to find out the road names we --- stitch together the touching ways with the same name --- to allow for nice label rendering --- Because this works well for roads that do not have relations as well - --- etldoc: osm_highway_linestring -> osm_highway_name_linestring -CREATE TABLE IF NOT EXISTS osm_highway_name_linestring AS ( - SELECT - (ST_Dump(geometry)).geom AS geometry, - -- NOTE: The osm_id is no longer the original one which can make it difficult - -- to lookup road names by OSM ID - member_osm_ids[0] AS osm_id, - member_osm_ids, - name, - ref, - highway, - z_order - FROM ( - SELECT - ST_LineMerge(ST_Union(geometry)) AS geometry, - name, - ref, - highway, - min(z_order) AS z_order, - array_agg(DISTINCT osm_id) AS member_osm_ids - FROM osm_highway_linestring - -- We only care about roads for labelling - WHERE name <> '' OR ref <> '' - GROUP BY name, highway, ref - ) AS highway_union -); - -CREATE INDEX IF NOT EXISTS osm_highway_name_linestring_geometry_idx ON osm_highway_name_linestring USING gist(geometry); - --- etldoc: osm_highway_name_linestring -> osm_highway_name_linestring_gen1 -CREATE TABLE IF NOT EXISTS osm_highway_name_linestring_gen1 AS ( - SELECT ST_Simplify(geometry, 50) AS geometry, osm_id, member_osm_ids, name, ref, highway, z_order - FROM osm_highway_name_linestring - WHERE highway IN ('motorway','trunk') AND ST_Length(geometry) > 8000 -); -CREATE INDEX IF NOT EXISTS osm_highway_name_linestring_gen1_geometry_idx ON osm_highway_name_linestring_gen1 USING gist(geometry); - --- etldoc: osm_highway_name_linestring_gen1 -> osm_highway_name_linestring_gen2 -CREATE TABLE IF NOT EXISTS osm_highway_name_linestring_gen2 AS ( - SELECT ST_Simplify(geometry, 120) AS geometry, osm_id, member_osm_ids, name, ref, highway, z_order - FROM osm_highway_name_linestring_gen1 - WHERE highway IN ('motorway','trunk') AND ST_Length(geometry) > 14000 -); -CREATE INDEX IF NOT EXISTS osm_highway_name_linestring_gen2_geometry_idx ON osm_highway_name_linestring_gen2 USING gist(geometry); - --- etldoc: osm_highway_name_linestring_gen2 -> osm_highway_name_linestring_gen3 -CREATE TABLE IF NOT EXISTS osm_highway_name_linestring_gen3 AS ( - SELECT ST_Simplify(geometry, 120) AS geometry, osm_id, member_osm_ids, name, ref, highway, z_order - FROM osm_highway_name_linestring_gen2 - WHERE highway = 'motorway' AND ST_Length(geometry) > 20000 -); -CREATE INDEX IF NOT EXISTS osm_highway_name_linestring_gen3_geometry_idx ON osm_highway_name_linestring_gen3 USING gist(geometry); diff --git a/layers/railway/README.md b/layers/railway/README.md deleted file mode 100644 index 8a1bc51..0000000 --- a/layers/railway/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# railway - -The `railway` layer contains linestrings marking tracks from [OSM Railways](http://wiki.openstreetmap.org/wiki/Railways). -It contains tracks for [passenger and freight trains]() and smaller tracks for [Trams](http://wiki.openstreetmap.org/wiki/Tag:railway%3Dtram) or [similar](http://wiki.openstreetmap.org/wiki/Tag:railway%3Dlight_rail) vehicles. But also tracks for [subways](http://wiki.openstreetmap.org/wiki/Tag:railway%3Dsubway), [narrow-gauge trains](http://wiki.openstreetmap.org/wiki/Tag:railway%3Dnarrow_gauge) or [historic trains](http://wiki.openstreetmap.org/wiki/Tag:railway%3Dpreserved). -Non mainline tracks (marked with class `minor_rail`) used for [storage of trains](http://wiki.openstreetmap.org/wiki/Tag:service%3Dyard) and [maintenance](http://wiki.openstreetmap.org/wiki/Tag:service%3Dsiding) are contained in the highest zoom levels and should be styled more subtle than the mainline tracks with class `rail`. - -## Fields - -- **class**: Divides the track into mainline tracks (class `rail`) and less important tracks -used for maintenance (class `minor_rail`). -- **subclass**: Original value of the [`railway`](http://wiki.openstreetmap.org/wiki/Key:railway) can be one of -`rail`, `light_rail`, `subway`, `narrow_gauge`, `preserved`, `tram`. -- **properties**: Additional properties describing the nature of tracks. Can be either `bridge` or `tunnel`. - -## Mapping - -![](mapping.png) - - diff --git a/layers/railway/mapping b/layers/railway/mapping deleted file mode 100644 index d068987..0000000 --- a/layers/railway/mapping +++ /dev/null @@ -1,14 +0,0 @@ -digraph "Imposm Mapping" { - graph [rankdir=LR ranksep=3] - subgraph railway_linestring { - node [fixed_size=shape "width:"=20] - railway_linestring [shape=box] - key_railway [label=railway shape=box] - key_railway -> railway_linestring [label="rail -light_rail -subway -narrow_gauge -preserved -tram"] - } -} \ No newline at end of file diff --git a/layers/railway/mapping.png b/layers/railway/mapping.png deleted file mode 100644 index 52a472337b77d0c4713abdb97eec597e6ff00d8a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13139 zcmZ8|1yodF*Yz+A4Kjd8N{7;dq%=qiC`d@RAd=FJAl*tgC?S#xNT+m%fOMC1=l=}& zzVEmGwXU%S?sM;b?m7GHz0a8-WkqQmOj1k;1cDU9p*#7aw$Lteg z-Hr{Vm>SZ@4?7Az1{+&&sAr3tq&5>Wkp$Ddx?VXx*qY*BQC!ho(LGK+*Gj{6+y3!e zx7lgNt#`ZdN9sz)d~y<-0-Y%Izej?9Ln8|lM8}kbwN3VaAJb9UYGU}nWW4`#P}$?9 zL%OxMld|ZM@TvYC8IVO>B#cPNzr&alde=K))8D@Gzsu8!BDJUe?*#mIW7q=-*ErUS zjqHDy_J&4^AcHg3#P!?4?+^ZXqaG9zQg(E8v9F|AX_IlVHYB~=lN871p-+3et`|W% zWKju<5h+>)*Qj;JI%OjgJ?YBH&3*~i-ak9MF;LP z8_S31?L@nh$R*vgB%U8f7NZ3Zh1`x5;>yR-ZyrLF0|~Q1pQ45a313D6>W@i?nGb%x z>6k(ExCAVgU5|}XDfOe=C#H^U*_dpx_oy$b9p9c_ z9?zI`MAQ3zp0*q>m0jsg`79ZPf7O0{w!yAh^)7F*CrRC6B!6jT-|uFZsV*^WP&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- railway_linestring: - type: linestring - fields: - - name: osm_id - type: id - - name: geometry - type: geometry - - key: railway - name: railway - type: string - - name: z_order - type: wayzorder - - key: tunnel - name: is_tunnel - type: bool - - key: bridge - name: is_bridge - type: bool - - key: service - name: service - type: string - - key: usage - name: usage - type: string - mapping: - railway: - - rail - - light_rail - - subway - - narrow_gauge - - preserved - - tram diff --git a/layers/railway/railway.sql b/layers/railway/railway.sql deleted file mode 100644 index 7902211..0000000 --- a/layers/railway/railway.sql +++ /dev/null @@ -1,35 +0,0 @@ -CREATE OR REPLACE FUNCTION railway_class(railway text, service text) RETURNS TEXT AS $$ - SELECT CASE - WHEN railway='rail' AND service='' THEN 'rail' - ELSE 'minor_rail' - END; -$$ LANGUAGE SQL IMMUTABLE; - -CREATE OR REPLACE FUNCTION railway_brunnel(is_bridge boolean, is_tunnel boolean) RETURNS TEXT AS $$ - SELECT CASE - WHEN is_bridge THEN 'bridge' - WHEN is_tunnel THEN 'tunnel' - ELSE NULL - END; -$$ LANGUAGE SQL IMMUTABLE; - --- etldoc: layer_railway[shape=record fillcolor=lightpink, style="rounded,filled", --- etldoc: label="layer_railway | z13 | z14_" ] ; - -CREATE OR REPLACE FUNCTION layer_railway(bbox geometry, zoom_level int) -RETURNS TABLE(osm_id bigint, geometry geometry, class text, subclass text, properties railway_properties) AS $$ - SELECT osm_id, geometry, - railway_class(railway, service) AS class, - railway AS subclass, - to_railway_properties(is_bridge, is_tunnel) AS properties - FROM ( - -- etldoc: osm_railway_linestring -> layer_railway :z13 - SELECT * FROM osm_railway_linestring - WHERE zoom_level = 13 AND railway = 'rail' AND service='' - UNION ALL - -- etldoc: osm_railway_linestring -> layer_railway :z14_ - SELECT * FROM osm_railway_linestring WHERE zoom_level >= 14 - ) AS zoom_levels - WHERE geometry && bbox - ORDER BY z_order ASC; -$$ LANGUAGE SQL IMMUTABLE; diff --git a/layers/railway/railway.yaml b/layers/railway/railway.yaml deleted file mode 100644 index 913f4d6..0000000 --- a/layers/railway/railway.yaml +++ /dev/null @@ -1,25 +0,0 @@ -layer: - id: "railway" - description: | - The `railway` layer contains linestrings marking tracks from [OSM Railways](http://wiki.openstreetmap.org/wiki/Railways). - It contains tracks for [passenger and freight trains]() and smaller tracks for [Trams](http://wiki.openstreetmap.org/wiki/Tag:railway%3Dtram) or [similar](http://wiki.openstreetmap.org/wiki/Tag:railway%3Dlight_rail) vehicles. But also tracks for [subways](http://wiki.openstreetmap.org/wiki/Tag:railway%3Dsubway), [narrow-gauge trains](http://wiki.openstreetmap.org/wiki/Tag:railway%3Dnarrow_gauge) or [historic trains](http://wiki.openstreetmap.org/wiki/Tag:railway%3Dpreserved). - Non mainline tracks (marked with class `minor_rail`) used for [storage of trains](http://wiki.openstreetmap.org/wiki/Tag:service%3Dyard) and [maintenance](http://wiki.openstreetmap.org/wiki/Tag:service%3Dsiding) are contained in the highest zoom levels and should be styled more subtle than the mainline tracks with class `rail`. - fields: - class: | - Divides the track into mainline tracks (class `rail`) and less important tracks - used for maintenance (class `minor_rail`). - subclass: | - Original value of the [`railway`](http://wiki.openstreetmap.org/wiki/Key:railway) can be one of - `rail`, `light_rail`, `subway`, `narrow_gauge`, `preserved`, `tram`. - properties: | - Additional properties describing the nature of tracks. Can be either `bridge` or `tunnel`. - buffer_size: 4 - datasource: - geometry_field: geometry - query: (SELECT geometry, class, subclass, properties::text FROM layer_railway(!bbox!, z(!scale_denominator!))) AS t -schema: - - ./types.sql - - ./railway.sql -datasources: - - type: imposm3 - mapping_file: ./mapping.yaml diff --git a/layers/railway/types.sql b/layers/railway/types.sql deleted file mode 100644 index e323edd..0000000 --- a/layers/railway/types.sql +++ /dev/null @@ -1,15 +0,0 @@ -DO $$ -BEGIN - IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'railway_properties') THEN - CREATE TYPE railway_properties AS ENUM ('bridge', 'tunnel'); - END IF; -END -$$; - -CREATE OR REPLACE FUNCTION to_railway_properties(is_bridge boolean, is_tunnel boolean) RETURNS railway_properties AS $$ - SELECT CASE - WHEN is_bridge THEN 'bridge'::railway_properties - WHEN is_tunnel THEN 'tunnel'::railway_properties - ELSE NULL - END; -$$ LANGUAGE SQL IMMUTABLE; diff --git a/layers/highway/README.md b/layers/transportation/README.md similarity index 100% rename from layers/highway/README.md rename to layers/transportation/README.md diff --git a/layers/highway/highway.sql b/layers/transportation/highway.sql similarity index 63% rename from layers/highway/highway.sql rename to layers/transportation/highway.sql index 09bf901..fa10c6a 100644 --- a/layers/highway/highway.sql +++ b/layers/transportation/highway.sql @@ -1,13 +1,11 @@ - - CREATE OR REPLACE FUNCTION highway_is_link(highway TEXT) RETURNS BOOLEAN AS $$ SELECT highway LIKE '%_link'; $$ LANGUAGE SQL IMMUTABLE STRICT; --- etldoc: layer_highway[shape=record fillcolor=lightpink, style="rounded,filled", --- etldoc: label=" layer_highway | z4-z7 | z8 | z9 | z10 | z11 | z12| z13| z14_" ] ; -CREATE OR REPLACE FUNCTION layer_highway(bbox geometry, zoom_level int) +-- etldoc: layer_transportation[shape=record fillcolor=lightpink, style="rounded,filled", +-- etldoc: label=" layer_transportation | z4-z7 | z8 | z9 | z10 | z11 | z12| z13| z14_" ] ; +CREATE OR REPLACE FUNCTION layer_transportation(bbox geometry, zoom_level int) RETURNS TABLE(osm_id bigint, geometry geometry, class highway_class, subclass text, properties highway_properties) AS $$ SELECT osm_id, geometry, @@ -15,8 +13,8 @@ RETURNS TABLE(osm_id bigint, geometry geometry, class highway_class, subclass te to_highway_properties(is_bridge, is_tunnel, is_ford, is_ramp, is_oneway) AS properties FROM ( - -- etldoc: ne_10m_global_roads -> layer_highway:z4z7 - SELECT + -- etldoc: ne_10m_global_roads -> layer_transportation:z4z7 + SELECT NULL::bigint AS osm_id, geometry, highway, FALSE AS is_bridge, FALSE AS is_tunnel, FALSE AS is_ford, FALSE AS is_ramp, FALSE AS is_oneway, 0 AS z_order @@ -24,59 +22,59 @@ RETURNS TABLE(osm_id bigint, geometry geometry, class highway_class, subclass te WHERE zoom_level BETWEEN 4 AND 7 AND scalerank <= 1 + zoom_level UNION ALL - -- etldoc: osm_highway_linestring_gen4 -> layer_highway:z8 + -- etldoc: osm_transportation_linestring_gen4 -> layer_transportation:z8 SELECT osm_id, geometry, highway, is_bridge, is_tunnel, is_ford, is_ramp, is_oneway, z_order - FROM osm_highway_linestring_gen4 + FROM osm_transportation_linestring_gen4 WHERE zoom_level = 8 UNION ALL - -- etldoc: osm_highway_linestring_gen3 -> layer_highway:z9 + -- etldoc: osm_transportation_linestring_gen3 -> layer_transportation:z9 SELECT osm_id, geometry, highway, is_bridge, is_tunnel, is_ford, is_ramp, is_oneway, z_order - FROM osm_highway_linestring_gen3 + FROM osm_transportation_linestring_gen3 WHERE zoom_level = 9 UNION ALL - -- etldoc: osm_highway_linestring_gen2 -> layer_highway:z10 + -- etldoc: osm_transportation_linestring_gen2 -> layer_transportation:z10 SELECT osm_id, geometry, highway, is_bridge, is_tunnel, is_ford, is_ramp, is_oneway, z_order - FROM osm_highway_linestring_gen2 + FROM osm_transportation_linestring_gen2 WHERE zoom_level = 10 UNION ALL - -- etldoc: osm_highway_linestring_gen1 -> layer_highway:z11 + -- etldoc: osm_transportation_linestring_gen1 -> layer_transportation:z11 SELECT osm_id, geometry, highway, is_bridge, is_tunnel, is_ford, is_ramp, is_oneway, z_order - FROM osm_highway_linestring_gen1 + FROM osm_transportation_linestring_gen1 WHERE zoom_level = 11 UNION ALL - -- etldoc: osm_highway_linestring -> layer_highway:z12 + -- etldoc: osm_transportation_linestring -> layer_transportation:z12 SELECT osm_id, geometry, highway, is_bridge, is_tunnel, is_ford, is_ramp, is_oneway, z_order - FROM osm_highway_linestring + FROM osm_transportation_linestring WHERE zoom_level = 12 AND (to_highway_class(highway) < 'minor_road'::highway_class OR highway IN ('unclassified', 'residential')) AND NOT highway_is_link(highway) AND NOT is_area UNION ALL - -- etldoc: osm_highway_linestring -> layer_highway:z13 + -- etldoc: osm_transportation_linestring -> layer_transportation:z13 SELECT osm_id, geometry, highway, is_bridge, is_tunnel, is_ford, is_ramp, is_oneway, z_order - FROM osm_highway_linestring + FROM osm_transportation_linestring WHERE zoom_level = 13 AND to_highway_class(highway) < 'path'::highway_class AND NOT is_area UNION ALL - -- etldoc: osm_highway_linestring -> layer_highway:z14_ + -- etldoc: osm_transportation_linestring -> layer_transportation:z14_ SELECT osm_id, geometry, highway, is_bridge, is_tunnel, is_ford, is_ramp, is_oneway, z_order - FROM osm_highway_linestring + FROM osm_transportation_linestring WHERE zoom_level >= 14 AND NOT is_area UNION ALL -- NOTE: We limit the selection of polys because we need to be careful to net get false positives here because -- it is possible that closed linestrings appear both as highway linestrings and as polygon - -- etldoc: osm_highway_polygon -> layer_highway:z13 - -- etldoc: osm_highway_polygon -> layer_highway:z14_ + -- etldoc: osm_transportation__polygon -> layer_transportation:z13 + -- etldoc: osm_transportation__polygon -> layer_transportation:z14_ SELECT osm_id, geometry, highway, FALSE AS is_bridge, FALSE AS is_tunnel, FALSE AS is_ford, FALSE AS is_ramp, FALSE AS is_oneway, z_order - FROM osm_highway_polygon + FROM osm_transportation_polygon -- We do not want underground pedestrian areas for now WHERE zoom_level >= 13 AND is_area AND COALESCE(layer, 0) >= 0 ) AS zoom_levels diff --git a/layers/transportation/mapping b/layers/transportation/mapping new file mode 100644 index 0000000..b5a7470 --- /dev/null +++ b/layers/transportation/mapping @@ -0,0 +1,39 @@ +digraph "Imposm Mapping" { + graph [rankdir=LR ranksep=3] + subgraph highway_polygon { + node [fixed_size=shape "width:"=20] + highway_polygon [shape=box] + key_highway [label=highway shape=box] + key_highway -> highway_polygon [label=pedestrian] + } + subgraph highway_linestring { + node [fixed_size=shape "width:"=20] + highway_linestring [shape=box] + key_highway [label=highway shape=box] + key_highway -> highway_linestring [label="motorway +motorway_link +trunk +trunk_link +primary +primary_link +secondary +secondary_link +tertiary +tertiary_link +unclassified +residential +road +living_street +raceway +construction +track +service +path +cycleway +bridleway +footway +corridor +crossing +pedestrian"] + } +} \ No newline at end of file diff --git a/layers/highway/mapping.png b/layers/transportation/mapping.png similarity index 100% rename from layers/highway/mapping.png rename to layers/transportation/mapping.png diff --git a/layers/highway/mapping.yaml b/layers/transportation/mapping.yaml similarity index 66% rename from layers/highway/mapping.yaml rename to layers/transportation/mapping.yaml index cbd8fed..3ba3da0 100644 --- a/layers/highway/mapping.yaml +++ b/layers/transportation/mapping.yaml @@ -1,33 +1,33 @@ generalized_tables: -# etldoc: imposm3 -> osm_highway_linestring_gen4 - highway_linestring_gen4: - source: highway_linestring_gen3 +# etldoc: imposm3 -> osm_transportation_linestring_gen4 + transportation_linestring_gen4: + source: transportation_linestring_gen3 sql_filter: highway IN ('motorway','trunk') AND NOT is_area tolerance: 200.0 -# etldoc: imposm3 -> osm_highway_linestring_gen3 - highway_linestring_gen3: - source: highway_linestring_gen2 +# etldoc: imposm3 -> osm_transportation_linestring_gen3 + transportation_linestring_gen3: + source: transportation_linestring_gen2 sql_filter: highway IN ('motorway','trunk', 'primary') AND NOT is_area tolerance: 120.0 -# etldoc: imposm3 -> osm_highway_linestring_gen2 - highway_linestring_gen2: - source: highway_linestring_gen1 +# etldoc: imposm3 -> osm_transportation_linestring_gen2 + transportation_linestring_gen2: + source: transportation_linestring_gen1 sql_filter: highway IN ('motorway','trunk', 'primary', 'secondary') AND NOT is_area tolerance: 50.0 -# etldoc: imposm3 -> osm_highway_linestring_gen1 - highway_linestring_gen1: - source: highway_linestring +# etldoc: imposm3 -> osm_transportation_linestring_gen1 + transportation_linestring_gen1: + source: transportation_linestring sql_filter: highway IN ('motorway','trunk', 'primary', 'secondary', 'tertiary') AND NOT is_area tolerance: 20.0 tables: -# etldoc: imposm3 -> osm_highway_linestring - highway_linestring: +# etldoc: imposm3 -> osm_transportation_linestring + transportation_linestring: type: linestring fields: - name: osm_id @@ -37,6 +37,9 @@ tables: - name: highway key: highway type: string + - key: railway + name: railway + type: string - key: ref name: ref type: string @@ -63,12 +66,21 @@ tables: - key: name name: name type: string + - key: short_name + name: short_name + type: string - name: name_en key: name:en type: string - name: is_area key: area type: bool + - key: service + name: service + type: string + - key: usage + name: usage + type: string mapping: highway: - motorway @@ -96,9 +108,16 @@ tables: - corridor - crossing - pedestrian + railway: + - rail + - light_rail + - subway + - narrow_gauge + - preserved + - tram -# etldoc: imposm3 -> osm_highway_polygon - highway_polygon: +# etldoc: imposm3 -> osm_transportation_polygon + transportation_polygon: type: polygon fields: - name: osm_id diff --git a/layers/highway/ne_global_roads.sql b/layers/transportation/ne_global_roads.sql similarity index 100% rename from layers/highway/ne_global_roads.sql rename to layers/transportation/ne_global_roads.sql diff --git a/layers/highway/highway.yaml b/layers/transportation/transportation.yaml similarity index 96% rename from layers/highway/highway.yaml rename to layers/transportation/transportation.yaml index f028095..3d53067 100644 --- a/layers/highway/highway.yaml +++ b/layers/transportation/transportation.yaml @@ -1,5 +1,5 @@ layer: - id: "highway" + id: "transportation" description: | Roads or [`highway`](http://wiki.openstreetmap.org/wiki/Key:highway) in OpenStreetMap lingo. This layer is directly derived from the OSM road hierarchy which is why it is called `highway`. Only @@ -29,7 +29,7 @@ layer: datasource: geometry_field: geometry srid: 900913 - query: (SELECT geometry, class::text, subclass, properties::text FROM layer_highway(!bbox!, z(!scale_denominator!))) AS t + query: (SELECT geometry, class::text, subclass, properties::text FROM layer_transportation(!bbox!, z(!scale_denominator!))) AS t schema: - ./types.sql - ./ne_global_roads.sql diff --git a/layers/highway/types.sql b/layers/transportation/types.sql similarity index 100% rename from layers/highway/types.sql rename to layers/transportation/types.sql diff --git a/layers/highway_name/README.md b/layers/transportation_name/README.md similarity index 100% rename from layers/highway_name/README.md rename to layers/transportation_name/README.md diff --git a/layers/transportation_name/layer.sql b/layers/transportation_name/layer.sql new file mode 100644 index 0000000..6f62a9c --- /dev/null +++ b/layers/transportation_name/layer.sql @@ -0,0 +1,50 @@ + +-- etldoc: layer_transportation_name[shape=record fillcolor=lightpink, style="rounded,filled", +-- etldoc: label="layer_transportation_name | z8 | z9 | z10 | z11 | z12| z13| z14_" ] ; + +CREATE OR REPLACE FUNCTION layer_transportation_name(bbox geometry, zoom_level integer) +RETURNS TABLE(osm_id bigint, geometry geometry, name text, ref text, ref_length int, class highway_class, subclass text) AS $$ + SELECT osm_id, geometry, name, + NULLIF(ref, ''), NULLIF(LENGTH(ref), 0) AS ref_length, + to_highway_class(highway) AS class, highway AS subclass + FROM ( + + -- etldoc: osm_transportation_name_linestring_gen3 -> layer_transportation_name:z8 + SELECT * FROM osm_transportation_name_linestring_gen3 + WHERE zoom_level = 8 + UNION ALL + + -- etldoc: osm_transportation_name_linestring_gen2 -> layer_transportation_name:z9 + SELECT * FROM osm_transportation_name_linestring_gen2 + WHERE zoom_level = 9 + UNION ALL + + -- etldoc: osm_transportation_name_linestring_gen1 -> layer_transportation_name:z10 + -- etldoc: osm_transportation_name_linestring_gen1 -> layer_transportation_name:z11 + SELECT * FROM osm_transportation_name_linestring_gen1 + WHERE zoom_level BETWEEN 10 AND 11 + UNION ALL + + -- etldoc: osm_transportation_name_linestring -> layer_transportation_name:z12 + SELECT * FROM osm_transportation_name_linestring + WHERE zoom_level = 12 + AND LineLabel(zoom_level, COALESCE(NULLIF(name, ''), ref), geometry) + AND to_highway_class(highway) < 'minor_road'::highway_class + AND NOT highway_is_link(highway) + UNION ALL + + -- etldoc: osm_transportation_name_linestring -> layer_transportation_name:z13 + SELECT * FROM osm_transportation_name_linestring + WHERE zoom_level = 13 + AND LineLabel(zoom_level, COALESCE(NULLIF(name, ''), ref), geometry) + AND to_highway_class(highway) < 'path'::highway_class + UNION ALL + + -- etldoc: osm_transportation_name_linestring -> layer_transportation_name:z14_ + SELECT * FROM osm_transportation_name_linestring + WHERE zoom_level >= 14 + + ) AS zoom_levels + WHERE geometry && bbox + ORDER BY z_order ASC; +$$ LANGUAGE SQL IMMUTABLE; diff --git a/layers/transportation_name/merge_highways.sql b/layers/transportation_name/merge_highways.sql new file mode 100644 index 0000000..f681163 --- /dev/null +++ b/layers/transportation_name/merge_highways.sql @@ -0,0 +1,57 @@ +-- Instead of using relations to find out the road names we +-- stitch together the touching ways with the same name +-- to allow for nice label rendering +-- Because this works well for roads that do not have relations as well + +-- etldoc: osm_transportation_linestring -> osm_transportation_name_linestring +CREATE TABLE IF NOT EXISTS osm_transportation_name_linestring AS ( + SELECT + (ST_Dump(geometry)).geom AS geometry, + -- NOTE: The osm_id is no longer the original one which can make it difficult + -- to lookup road names by OSM ID + member_osm_ids[0] AS osm_id, + member_osm_ids, + name, + ref, + highway, + z_order + FROM ( + SELECT + ST_LineMerge(ST_Union(geometry)) AS geometry, + name, + ref, + highway, + min(z_order) AS z_order, + array_agg(DISTINCT osm_id) AS member_osm_ids + FROM osm_transportation_linestring + -- We only care about highways (not railways) for labeling + WHERE (name <> '' OR ref <> '') AND NULLIF(highway, '') IS NOT NULL + GROUP BY name, highway, ref + ) AS highway_union +); + +CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_geometry_idx ON osm_transportation_name_linestring USING gist(geometry); + +-- etldoc: osm_transportation_name_linestring -> osm_transportation_name_linestring_gen1 +CREATE TABLE IF NOT EXISTS osm_transportation_name_linestring_gen1 AS ( + SELECT ST_Simplify(geometry, 50) AS geometry, osm_id, member_osm_ids, name, ref, highway, z_order + FROM osm_transportation_name_linestring + WHERE highway 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); + +-- etldoc: osm_transportation_name_linestring_gen1 -> osm_transportation_name_linestring_gen2 +CREATE TABLE IF NOT EXISTS osm_transportation_name_linestring_gen2 AS ( + SELECT ST_Simplify(geometry, 120) AS geometry, osm_id, member_osm_ids, name, ref, highway, z_order + FROM osm_transportation_name_linestring_gen1 + WHERE highway 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); + +-- etldoc: osm_transportation_name_linestring_gen2 -> osm_transportation_name_linestring_gen3 +CREATE TABLE IF NOT EXISTS osm_transportation_name_linestring_gen3 AS ( + SELECT ST_Simplify(geometry, 120) AS geometry, osm_id, member_osm_ids, name, ref, highway, z_order + FROM osm_transportation_name_linestring_gen2 + WHERE highway = '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); diff --git a/layers/highway_name/highway_name.yaml b/layers/transportation_name/transportation_name.yaml similarity index 90% rename from layers/highway_name/highway_name.yaml rename to layers/transportation_name/transportation_name.yaml index 69751b3..27e55bf 100644 --- a/layers/highway_name/highway_name.yaml +++ b/layers/transportation_name/transportation_name.yaml @@ -1,5 +1,5 @@ layer: - id: "highway_name" + id: "transportation_name" description: | This is the layer for labelling the highways. Only highways that are named `name=*` and are long enough to place text upon appear. The OSM roads are stitched together if they contain the same name @@ -20,10 +20,10 @@ layer: datasource: geometry_field: geometry srid: 900913 - query: (SELECT geometry, name, ref, ref_length, class::text, subclass FROM layer_highway_name(!bbox!, z(!scale_denominator!))) AS t + query: (SELECT geometry, name, ref, ref_length, class::text, subclass FROM layer_transportation_name(!bbox!, z(!scale_denominator!))) AS t schema: - ./merge_highways.sql - ./layer.sql datasources: - type: imposm3 - mapping_file: ../highway/mapping.yaml + mapping_file: ../transportation/mapping.yaml diff --git a/openmaptiles.yaml b/openmaptiles.yaml index 0ab0126..2013d40 100644 --- a/openmaptiles.yaml +++ b/openmaptiles.yaml @@ -1,13 +1,12 @@ tileset: layers: - layers/boundary/boundary.yaml - - layers/highway/highway.yaml - - layers/highway_name/highway_name.yaml + - layers/transportation/transportation.yaml + - layers/transportation_name/transportation_name.yaml - layers/building/building.yaml - layers/housenumber/housenumber.yaml - layers/place/place.yaml - layers/poi/poi.yaml - - layers/railway/railway.yaml - layers/water_name/water_name.yaml - layers/water/water.yaml - layers/waterway/waterway.yaml