diff --git a/layers/transportation/mapping.yaml b/layers/transportation/mapping.yaml index f5109c30..59819478 100644 --- a/layers/transportation/mapping.yaml +++ b/layers/transportation/mapping.yaml @@ -92,6 +92,10 @@ service_field: &service key: service name: service type: string +access_field: &access + key: access + name: access + type: string usage_field: &usage key: usage name: usage @@ -183,6 +187,7 @@ tables: - *oneway - *area - *service + - *access - *usage - *public_transport - *man_made diff --git a/layers/transportation/transportation.sql b/layers/transportation/transportation.sql index f357ab7a..77107f58 100644 --- a/layers/transportation/transportation.sql +++ b/layers/transportation/transportation.sql @@ -20,6 +20,7 @@ CREATE OR REPLACE FUNCTION layer_transportation(bbox geometry, zoom_level int) oneway int, brunnel text, service text, + access text, layer int, level int, indoor int, @@ -57,6 +58,7 @@ SELECT osm_id, is_oneway::int AS oneway, brunnel(is_bridge, is_tunnel, is_ford) AS brunnel, NULLIF(service, '') AS service, + access, NULLIF(layer, 0) AS layer, "level", CASE WHEN indoor = TRUE THEN 1 END AS indoor, @@ -77,6 +79,7 @@ FROM ( NULL AS shipway, NULL AS public_transport, NULL AS service, + NULL AS access, is_bridge, is_tunnel, is_ford, @@ -107,6 +110,7 @@ FROM ( NULL AS shipway, NULL AS public_transport, NULL AS service, + NULL AS access, is_bridge, is_tunnel, is_ford, @@ -137,6 +141,7 @@ FROM ( NULL AS shipway, NULL AS public_transport, NULL AS service, + NULL AS access, is_bridge, is_tunnel, is_ford, @@ -167,6 +172,7 @@ FROM ( NULL AS shipway, NULL AS public_transport, NULL AS service, + NULL AS access, is_bridge, is_tunnel, is_ford, @@ -197,6 +203,7 @@ FROM ( NULL AS shipway, NULL AS public_transport, NULL AS service, + NULL AS access, is_bridge, is_tunnel, is_ford, @@ -227,6 +234,7 @@ FROM ( NULL AS shipway, NULL AS public_transport, NULL AS service, + access, is_bridge, is_tunnel, is_ford, @@ -257,6 +265,7 @@ FROM ( NULL AS shipway, NULL AS public_transport, NULL AS service, + access, is_bridge, is_tunnel, is_ford, @@ -287,6 +296,7 @@ FROM ( NULL AS shipway, NULL AS public_transport, NULL AS service, + access, is_bridge, is_tunnel, is_ford, @@ -319,6 +329,7 @@ FROM ( NULL AS shipway, public_transport, service_value(service) AS service, + CASE WHEN access IN ('private', 'no') THEN 'no' END AS access, is_bridge, is_tunnel, is_ford, @@ -368,6 +379,7 @@ FROM ( NULL AS shipway, NULL AS public_transport, service_value(service) AS service, + NULL::text AS access, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel, NULL::boolean AS is_ford, @@ -401,6 +413,7 @@ FROM ( NULL AS shipway, NULL AS public_transport, service_value(service) AS service, + NULL::text AS access, NULL::boolean AS is_bridge, NULL::boolean AS is_tunnel, NULL::boolean AS is_ford, @@ -434,6 +447,7 @@ FROM ( NULL AS shipway, NULL AS public_transport, service_value(service) AS service, + NULL::text AS access, is_bridge, is_tunnel, is_ford, @@ -466,6 +480,7 @@ FROM ( NULL AS shipway, NULL AS public_transport, service_value(service) AS service, + NULL::text AS access, is_bridge, is_tunnel, is_ford, @@ -498,6 +513,7 @@ FROM ( NULL AS shipway, NULL AS public_transport, service_value(service) AS service, + NULL::text AS access, is_bridge, is_tunnel, is_ford, @@ -531,6 +547,7 @@ FROM ( NULL AS shipway, NULL AS public_transport, service_value(service) AS service, + NULL::text AS access, is_bridge, is_tunnel, is_ford, @@ -564,6 +581,7 @@ FROM ( NULL AS shipway, NULL AS public_transport, service_value(service) AS service, + NULL::text AS access, is_bridge, is_tunnel, is_ford, @@ -595,6 +613,7 @@ FROM ( NULL AS shipway, NULL AS public_transport, service_value(service) AS service, + NULL::text AS access, is_bridge, is_tunnel, is_ford, @@ -625,6 +644,7 @@ FROM ( shipway, NULL AS public_transport, service_value(service) AS service, + NULL::text AS access, is_bridge, is_tunnel, is_ford, @@ -655,6 +675,7 @@ FROM ( shipway, NULL AS public_transport, service_value(service) AS service, + NULL::text AS access, is_bridge, is_tunnel, is_ford, @@ -686,6 +707,7 @@ FROM ( shipway, NULL AS public_transport, service_value(service) AS service, + NULL::text AS access, is_bridge, is_tunnel, is_ford, @@ -721,6 +743,7 @@ FROM ( NULL AS shipway, public_transport, NULL AS service, + NULL::text AS access, CASE WHEN man_made IN ('bridge') THEN TRUE ELSE FALSE diff --git a/layers/transportation/transportation.yaml b/layers/transportation/transportation.yaml index 1d9c1cdd..510a3594 100644 --- a/layers/transportation/transportation.yaml +++ b/layers/transportation/transportation.yaml @@ -146,6 +146,13 @@ layer: - driveway - alley - parking_aisle + access: + description: | + Access restrictions on this road. Supported values of the + [`access`](http://wiki.openstreetmap.org/wiki/Key:access) tag are `no` and `private`, + which resolve to `no`. + values: + - no layer: description: | Original value of the [`layer`](http://wiki.openstreetmap.org/wiki/Key:layer) tag. @@ -180,7 +187,7 @@ layer: datasource: geometry_field: geometry srid: 900913 - query: (SELECT geometry, class, subclass, network, oneway, ramp, brunnel, service, layer, level, indoor, bicycle, foot, horse, mtb_scale, surface FROM layer_transportation(!bbox!, z(!scale_denominator!))) AS t + query: (SELECT geometry, class, subclass, network, oneway, ramp, brunnel, service, access, layer, level, indoor, bicycle, foot, horse, mtb_scale, surface FROM layer_transportation(!bbox!, z(!scale_denominator!))) AS t schema: - ./network_type.sql - ./class.sql diff --git a/layers/transportation/update_transportation_merge.sql b/layers/transportation/update_transportation_merge.sql index 8e92b4ed..34ebfdee 100644 --- a/layers/transportation/update_transportation_merge.sql +++ b/layers/transportation/update_transportation_merge.sql @@ -29,10 +29,14 @@ SELECT (ST_Dump(ST_LineMerge(ST_Collect(geometry)))).geom AS geometry, foot, horse, mtb_scale, + CASE + WHEN access IN ('private', 'no') + THEN 'no' + ELSE NULL::text END AS access, layer FROM osm_highway_linestring_gen_z11 -- mapping.yaml pre-filter: motorway/trunk/primary/secondary/tertiary, with _link variants, construction, ST_IsValid() -GROUP BY highway, network, construction, is_bridge, is_tunnel, is_ford, bicycle, foot, horse, mtb_scale, layer +GROUP BY highway, network, construction, is_bridge, is_tunnel, is_ford, bicycle, foot, horse, mtb_scale, access, layer ) /* DELAY_MATERIALIZED_VIEW_CREATION */; CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen_z11_geometry_idx ON osm_transportation_merge_linestring_gen_z11 USING gist (geometry); @@ -53,6 +57,7 @@ SELECT ST_Simplify(geometry, ZRes(12)) AS geometry, foot, horse, mtb_scale, + access, layer FROM osm_transportation_merge_linestring_gen_z11 WHERE highway NOT IN ('tertiary', 'tertiary_link') @@ -77,6 +82,7 @@ SELECT ST_Simplify(geometry, ZRes(11)) AS geometry, foot, horse, mtb_scale, + access, layer FROM osm_transportation_merge_linestring_gen_z10 -- Current view: motorway/primary/secondary, with _link variants and construction @@ -100,6 +106,7 @@ FROM osm_transportation_merge_linestring_gen_z9 WHERE (highway IN ('motorway', 'trunk', 'primary') OR construction IN ('motorway', 'trunk', 'primary')) AND ST_IsValid(geometry) + AND access IS NULL GROUP BY highway, network, construction, is_bridge, is_tunnel, is_ford ) /* DELAY_MATERIALIZED_VIEW_CREATION */; CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen_z8_geometry_idx