From 90099273e66a3e2dc061a3155fd6a1dfc9a2fad5 Mon Sep 17 00:00:00 2001 From: lukasmartinelli Date: Tue, 28 Jun 2016 20:22:23 +0200 Subject: [PATCH] Make sure at least very basic motorway junctions are shown --- osm2vectortiles.tm2source/data.yml | 7 ++----- src/import-osm/mapping.yml | 6 ++++++ src/import-sql/layers/motorway_junction.sql | 18 +++++++++++------- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/osm2vectortiles.tm2source/data.yml b/osm2vectortiles.tm2source/data.yml index 0f8908d..d5bd2a4 100644 --- a/osm2vectortiles.tm2source/data.yml +++ b/osm2vectortiles.tm2source/data.yml @@ -955,12 +955,9 @@ Layer: name, NULLIF(ref, '') AS ref, NULLIF(char_length(ref), 0) AS reflen, - type, - road_class(type, NULL, NULL) AS class + junction_type(type) AS type, + road_type_class(junction_type(type)) AS class FROM ( - SELECT * FROM motorway_junction_z11 - WHERE z(!scale_denominator!) = 11 - UNION ALL SELECT * FROM motorway_junction_z12toz14 WHERE z(!scale_denominator!) BETWEEN 12 AND 14 ) AS t diff --git a/src/import-osm/mapping.yml b/src/import-osm/mapping.yml index 9806a6c..c3ddb95 100644 --- a/src/import-osm/mapping.yml +++ b/src/import-osm/mapping.yml @@ -490,6 +490,12 @@ tables: - name: name key: name type: string + mapping: + highway: + - motorway_junction + filters: + exclude_tags: + - [ "ref", "__nil__" ] road_geometry: type: geometry fields: diff --git a/src/import-sql/layers/motorway_junction.sql b/src/import-sql/layers/motorway_junction.sql index 28017fa..27a3daf 100644 --- a/src/import-sql/layers/motorway_junction.sql +++ b/src/import-sql/layers/motorway_junction.sql @@ -1,9 +1,13 @@ -CREATE OR REPLACE VIEW motorway_junction_z11 AS - SELECT id AS osm_id, type, ref, name, geometry - FROM osm_motorway_junction_point - WHERE ref <> '' AND type <> 'trunk'; - CREATE OR REPLACE VIEW motorway_junction_z12toz14 AS SELECT id AS osm_id, type, ref, name, geometry - FROM osm_motorway_junction_point - WHERE ref <> ''; + FROM osm_motorway_junction_point; + +CREATE OR REPLACE FUNCTION junction_type(type VARCHAR) RETURNS VARCHAR +AS $$ +BEGIN + RETURN CASE + WHEN type = 'motorway_junction' THEN 'motorway' + ELSE type + END; +END; +$$ LANGUAGE plpgsql IMMUTABLE;