diff --git a/layers/transportation/layer.sql b/layers/transportation/layer.sql index 9868768..561f611 100644 --- a/layers/transportation/layer.sql +++ b/layers/transportation/layer.sql @@ -8,7 +8,7 @@ $$ 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 @@ -34,6 +34,10 @@ 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 @@ -45,8 +49,8 @@ indoor INT, surface TEXT) AS $$ 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 @@ -60,6 +64,7 @@ indoor INT, surface TEXT) AS $$ 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 @@ -74,6 +79,7 @@ indoor INT, surface TEXT) AS $$ 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 @@ -88,6 +94,7 @@ indoor INT, surface TEXT) AS $$ 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 @@ -102,6 +109,7 @@ indoor INT, surface TEXT) AS $$ 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 @@ -117,6 +125,7 @@ indoor INT, surface TEXT) AS $$ 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 @@ -132,6 +141,7 @@ indoor INT, surface TEXT) AS $$ 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 @@ -153,6 +163,7 @@ 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 @@ -185,7 +196,8 @@ indoor INT, surface TEXT) AS $$ 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' @@ -200,7 +212,8 @@ indoor INT, surface TEXT) AS $$ 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' @@ -213,6 +226,7 @@ indoor INT, surface TEXT) AS $$ 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 @@ -226,6 +240,7 @@ indoor INT, surface TEXT) AS $$ 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 @@ -239,6 +254,7 @@ indoor INT, surface TEXT) AS $$ 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 @@ -253,6 +269,7 @@ indoor INT, surface TEXT) AS $$ 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 @@ -267,6 +284,7 @@ indoor INT, surface TEXT) AS $$ 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 @@ -280,6 +298,7 @@ indoor INT, surface TEXT) AS $$ 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 @@ -292,6 +311,7 @@ indoor INT, surface TEXT) AS $$ 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 @@ -304,6 +324,7 @@ indoor INT, surface TEXT) AS $$ 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 @@ -317,6 +338,7 @@ indoor INT, surface TEXT) AS $$ 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 @@ -337,6 +359,7 @@ indoor INT, surface TEXT) AS $$ 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 diff --git a/layers/transportation/mapping.yaml b/layers/transportation/mapping.yaml index e4e8f7b..29c0c25 100644 --- a/layers/transportation/mapping.yaml +++ b/layers/transportation/mapping.yaml @@ -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 @@ -175,6 +191,10 @@ tables: - *usage - *public_transport - *man_made + - *bicycle + - *foot + - *horse + - *mtb_scale - *surface mapping: highway: diff --git a/layers/transportation/transportation.yaml b/layers/transportation/transportation.yaml index 61f7499..c080bf2 100644 --- a/layers/transportation/transportation.yaml +++ b/layers/transportation/transportation.yaml @@ -106,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). + hourse: + description: | + Original value of the [`hourse`](http://wiki.openstreetmap.org/wiki/Key:hourse) 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). @@ -126,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