Remove subclass from transport

This commit is contained in:
Lukas Martinelli 2016-12-02 12:36:10 +00:00
parent 227b36c0d6
commit a109ffd72e
2 changed files with 15 additions and 53 deletions

View File

@ -6,14 +6,13 @@ $$ 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 |<z4z6> z4-z6 |<z7z8> z7-z8 |<z9> z9 |<z10> z10 |<z11> z11 |<z12> z12|<z13> z13|<z14_> z14+" ] ; -- etldoc: label="<sql> layer_transportation |<z4z6> z4-z6 |<z7z8> z7-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, subclass text, ramp int, oneway int, brunnel TEXT, service TEXT) AS $$ RETURNS TABLE(osm_id bigint, geometry geometry, class 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,
COALESCE(NULLIF(highway,''), NULLIF(railway, '')) 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,

View File

@ -1,23 +1,23 @@
layer: layer:
id: "transportation" id: "transportation"
description: | description: |
**transportation** containsrRoads and railways. **transportation** contains roads and railways.
This layer is directly derived from the OSM road hierarchy which is why it is called `highway`. Only This layer is directly derived from the OSM road hierarchy.
at zoom level 4 to 7 some major highways from Natural Earth are used otherwise it is only OSM data. Only at zoom level 4 to 6 some major highways from Natural Earth
It contains all roads from motorways to primary, secondary and tertiary roads to residential roads and are used.
foot paths. Styling the roads is the most essential part of the map. If you can put enough effort into it It contains all roads from motorways to primary, secondary and
makes sense to carefully style each `subclass`. For more comfortable styling you can also just style the roads tertiary roads to residential roads and
by `class`. Roads can have different properties, a road can have `oneway=yes` and `bridge=yes` at the same time. foot paths. Styling the roads is the most essential part of the map.
These properties are reflected in the field `properties`.
This layer is not meant for labelling the roads (the purpose of the layer `highway_name`).
The `highway` layer also contains polygons for things like plazas. The `highway` layer also contains polygons for things like plazas.
buffer_size: 4 buffer_size: 4
srs: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over srs: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over
fields: fields:
class: class:
description: | description: |
Distinguish between more and less important roads. Distinguish between more and less important roads or railways.
Class is derived from the value of the
[`highway`](http://wiki.openstreetmap.org/wiki/Key:highway) or
[`railway`](http://wiki.openstreetmap.org/wiki/Key:railway) tag.
values: values:
- motorway - motorway
- trunk - trunk
@ -25,49 +25,12 @@ layer:
- secondary - secondary
- tertiary - tertiary
- minor - minor
- track
- service - service
- track
- path - path
subclass:
description: |
Use **subclass** to do more precise styling.
Original value of the
[`highway`](http://wiki.openstreetmap.org/wiki/Key:highway) or
[`railway`](http://wiki.openstreetmap.org/wiki/Key:railway) tag.
values:
- motorway
- motorway_link
- trunk
- trunk_link
- primary
- primary_link
- secondary
- secondary_link
- tertiary
- tertiary_link
- unclassified
- residential
- road
- living_street
- raceway - raceway
- construction
- track
- service
- path
- cycleway
- bridleway
- footway
- corridor
- crossing
- pedestrian
- rail - rail
- narrow_gauge - transit
- 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.
@ -99,7 +62,7 @@ layer:
datasource: datasource:
geometry_field: geometry geometry_field: geometry
srid: 900913 srid: 900913
query: (SELECT geometry, class, subclass, oneway, ramp, brunnel, service FROM layer_transportation(!bbox!, z(!scale_denominator!))) AS t query: (SELECT geometry, class, oneway, ramp, brunnel, service FROM layer_transportation(!bbox!, z(!scale_denominator!))) AS t
schema: schema:
- ./class.sql - ./class.sql
- ./layer.sql - ./layer.sql