Skip to content

Commit

Permalink
Fixes #3280 - code by @imagico - idea by @woodpeck
Browse files Browse the repository at this point in the history
  • Loading branch information
sommerluk committed Aug 21, 2018
1 parent 29f7dfb commit eb01f60
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,8 @@ Layer:
link,
layernotnull
FROM ( -- subselect that contains both roads and rail/aero
SELECT
WITH features_real AS ( -- this is the actual data (which is used both as is and to determine the distinct layer values present in it)
SELECT
way,
'highway_' || highway AS feature, --only motorway to tertiary links are accepted later on
horse,
Expand Down Expand Up @@ -1142,6 +1143,23 @@ Layer:
FROM planet_osm_line
WHERE bridge IN ('yes', 'boardwalk', 'cantilever', 'covered', 'low_water_crossing', 'movable', 'trestle', 'viaduct')
AND highway IS NOT NULL -- end of road select
AND way && !bbox!
)
SELECT
way,
feature,
horse,
foot,
bicycle,
tracktype,
int_surface,
access,
construction,
service,
link,
layernotnull,
z_order
FROM features_real
UNION ALL
SELECT
ST_MakeEnvelope(-20037508.342789244, -20037508.342789244, 20037508.342789244, 20037508.342789244, 900913) AS way,
Expand All @@ -1158,18 +1176,7 @@ Layer:
layernotnull,
NULL AS z_order
FROM
(SELECT DISTINCT
layernotnull
FROM
(SELECT
COALESCE(layer,0) AS layernotnull
FROM planet_osm_line
WHERE bridge IN ('yes', 'boardwalk', 'cantilever', 'covered', 'low_water_crossing', 'movable', 'trestle', 'viaduct')
AND highway IS NOT NULL
AND surface IN ('unpaved', 'compacted', 'dirt', 'earth', 'fine_gravel', 'grass', 'grass_paver', 'gravel', 'ground',
'mud', 'pebblestone', 'salt', 'sand', 'woodchips', 'clay', 'ice', 'snow', 'unhewn_cobblestone') -- end of road select
) AS roads
) AS layers_list
(SELECT DISTINCT layernotnull FROM features_real) AS layers_list
UNION ALL
SELECT
way,
Expand All @@ -1195,6 +1202,7 @@ Layer:
FROM planet_osm_line
WHERE bridge IN ('yes', 'boardwalk', 'cantilever', 'covered', 'low_water_crossing', 'movable', 'trestle', 'viaduct')
AND railway IS NOT NULL -- end of rail select
AND way && !bbox!
) AS features
ORDER BY
layernotnull,
Expand Down

0 comments on commit eb01f60

Please sign in to comment.