Create subclass attribute of railways
This commit is contained in:
@@ -6,13 +6,18 @@ $$ LANGUAGE SQL IMMUTABLE STRICT;
|
|||||||
-- etldoc: layer_transportation[shape=record fillcolor=lightpink, style="rounded,filled",
|
-- etldoc: layer_transportation[shape=record fillcolor=lightpink, style="rounded,filled",
|
||||||
-- etldoc: label="<sql> layer_transportation |<z4> z4 |<z5> z5 |<z6> z6 |<z7> z7 |<z8> z8 |<z9> z9 |<z10> z10 |<z11> z11 |<z12> z12|<z13> z13|<z14_> z14+" ] ;
|
-- etldoc: label="<sql> layer_transportation |<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_transportation(bbox geometry, zoom_level int)
|
CREATE OR REPLACE FUNCTION layer_transportation(bbox geometry, zoom_level int)
|
||||||
RETURNS TABLE(osm_id bigint, geometry geometry, class text, ramp int, oneway int, brunnel TEXT, service TEXT) AS $$
|
RETURNS TABLE(osm_id bigint, geometry geometry, class text, subclass text,
|
||||||
|
ramp int, oneway int, brunnel TEXT, service TEXT) AS $$
|
||||||
SELECT
|
SELECT
|
||||||
osm_id, geometry,
|
osm_id, geometry,
|
||||||
CASE
|
CASE
|
||||||
WHEN highway IS NOT NULL THEN highway_class(highway)
|
WHEN highway IS NOT NULL THEN highway_class(highway)
|
||||||
WHEN railway IS NOT NULL THEN railway_class(railway)
|
WHEN railway IS NOT NULL THEN railway_class(railway)
|
||||||
END AS class,
|
END AS class,
|
||||||
|
CASE
|
||||||
|
WHEN railway IS NOT NULL THEN railway
|
||||||
|
ELSE NULL
|
||||||
|
END AS subclass,
|
||||||
-- All links are considered as ramps as well
|
-- All links are considered as ramps as well
|
||||||
CASE WHEN highway_is_link(highway) OR highway = 'steps'
|
CASE WHEN highway_is_link(highway) OR highway = 'steps'
|
||||||
THEN 1 ELSE is_ramp::int END AS ramp,
|
THEN 1 ELSE is_ramp::int END AS ramp,
|
||||||
|
|||||||
@@ -30,6 +30,20 @@ layer:
|
|||||||
- raceway
|
- raceway
|
||||||
- rail
|
- rail
|
||||||
- transit
|
- transit
|
||||||
|
subclass:
|
||||||
|
description: |
|
||||||
|
Distinguish more specific railway classes:
|
||||||
|
Subclass is value of the
|
||||||
|
[`railway`](http://wiki.openstreetmap.org/wiki/Key:railway) tag.
|
||||||
|
values:
|
||||||
|
- rail
|
||||||
|
- narrow_gauge
|
||||||
|
- preserved
|
||||||
|
- funicular
|
||||||
|
- subway
|
||||||
|
- light_rail
|
||||||
|
- monorail
|
||||||
|
- tram
|
||||||
brunnel:
|
brunnel:
|
||||||
description: |
|
description: |
|
||||||
Mark whether way is a tunnel or bridge.
|
Mark whether way is a tunnel or bridge.
|
||||||
@@ -61,7 +75,7 @@ layer:
|
|||||||
datasource:
|
datasource:
|
||||||
geometry_field: geometry
|
geometry_field: geometry
|
||||||
srid: 900913
|
srid: 900913
|
||||||
query: (SELECT geometry, class, oneway, ramp, brunnel, service FROM layer_transportation(!bbox!, z(!scale_denominator!))) AS t
|
query: (SELECT geometry, class, subclass, oneway, ramp, brunnel, service FROM layer_transportation(!bbox!, z(!scale_denominator!))) AS t
|
||||||
schema:
|
schema:
|
||||||
- ./class.sql
|
- ./class.sql
|
||||||
- ./update_transportation_merge.sql
|
- ./update_transportation_merge.sql
|
||||||
|
|||||||
Reference in New Issue
Block a user