Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render “surface” tag on roads with a pattern #2640

Merged
merged 2 commits into from
May 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
170 changes: 145 additions & 25 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,8 @@ Layer:
z_order,
CASE WHEN substring(feature for 8) = 'railway_' THEN 2 ELSE 1 END,
CASE WHEN feature IN ('railway_INT-preserved-ssy', 'railway_INT-spur-siding-yard', 'railway_tram-service') THEN 0 ELSE 1 END,
CASE WHEN feature IN ('highway_road') THEN 0 ELSE 1 END,
CASE WHEN feature IN ('highway_platform', 'railway_platform') THEN 0 ELSE 1 END,
CASE WHEN access IN ('no', 'private') THEN 0 WHEN access IN ('destination') THEN 1 ELSE 2 END,
CASE WHEN int_surface IN ('unpaved') THEN 0 ELSE 2 END
) AS tunnels
Expand Down Expand Up @@ -794,6 +796,8 @@ Layer:
z_order,
CASE WHEN substring(feature for 8) = 'railway_' THEN 2 ELSE 1 END,
CASE WHEN feature IN ('railway_INT-preserved-ssy', 'railway_INT-spur-siding-yard', 'railway_tram-service') THEN 0 ELSE 1 END,
CASE WHEN feature IN ('highway_road') THEN 0 ELSE 1 END,
CASE WHEN feature IN ('highway_platform', 'railway_platform') THEN 0 ELSE 1 END,
CASE WHEN access IN ('no', 'private') THEN 0 WHEN access IN ('destination') THEN 1 ELSE 2 END,
CASE WHEN int_surface IN ('unpaved') THEN 0 ELSE 2 END
) AS roads_casing
Expand All @@ -816,7 +820,13 @@ Layer:
AND (covered NOT IN ('yes') OR covered IS NULL))
THEN railway ELSE NULL END)),
(('aeroway_' || CASE WHEN aeroway IN ('runway', 'taxiway', 'helipad') THEN aeroway ELSE NULL END))
) AS feature
) AS feature,
CASE WHEN surface IN ('unpaved', 'compacted', 'dirt', 'earth', 'fine_gravel', 'grass', 'grass_paver', 'gravel', 'ground',
'mud', 'pebblestone', 'salt', 'sand', 'woodchips', 'clay') THEN 'unpaved'
WHEN surface IN ('paved', 'asphalt', 'cobblestone', 'cobblestone:flattened', 'sett', 'concrete', 'concrete:lanes',
'concrete:plates', 'paving_stones', 'metal', 'wood') THEN 'paved'
ELSE NULL
END AS int_surface
FROM planet_osm_polygon
WHERE highway IN ('residential', 'unclassified', 'pedestrian', 'service', 'footway', 'living_street', 'track', 'path', 'platform', 'services')
OR (railway IN ('platform')
Expand Down Expand Up @@ -897,7 +907,12 @@ Layer:
foot,
bicycle,
tracktype,
'null' AS surface, -- Should be a SQL NULL?
CASE WHEN surface IN ('unpaved', 'compacted', 'dirt', 'earth', 'fine_gravel', 'grass', 'grass_paver', 'gravel', 'ground',
'mud', 'pebblestone', 'salt', 'sand', 'woodchips', 'clay') THEN 'unpaved'
WHEN surface IN ('paved', 'asphalt', 'cobblestone', 'cobblestone:flattened', 'sett', 'concrete', 'concrete:lanes',
'concrete:plates', 'paving_stones', 'metal', 'wood') THEN 'paved'
ELSE NULL
END AS int_surface,
CASE
WHEN access IN ('destination') THEN 'destination'::text
WHEN access IN ('no', 'private') THEN 'no'::text
Expand All @@ -914,12 +929,29 @@ Layer:
AND (covered IS NULL OR NOT covered = 'yes')
AND (bridge IS NULL OR NOT bridge IN ('yes', 'boardwalk', 'cantilever', 'covered', 'low_water_crossing', 'movable', 'trestle', 'viaduct'))
AND railway IS NOT NULL -- end of rail select
UNION ALL
(SELECT
ST_MakeEnvelope(-20037508.342789244, -20037508.342789244, 20037508.342789244, 20037508.342789244, 900913) AS way,
'globalboundingbox' AS feature,
NULL AS horse,
NULL AS foot,
NULL AS bicycle,
NULL AS tracktype,
NULL AS surface,
NULL AS access,
NULL AS construction,
NULL AS service,
NULL AS link,
NULL AS layernotnull,
NULL AS z_order
)
) AS features
ORDER BY
layernotnull,
z_order,
CASE WHEN substring(feature for 8) = 'railway_' THEN 2 ELSE 1 END,
CASE WHEN feature IN ('railway_INT-preserved-ssy', 'railway_INT-spur-siding-yard', 'railway_tram-service') THEN 0 ELSE 1 END,
CASE WHEN feature IN ('highway_road') THEN 0 ELSE 1 END,
CASE WHEN feature IN ('highway_platform', 'railway_platform') THEN 0 ELSE 1 END,
CASE WHEN access IN ('no', 'private') THEN 0 WHEN access IN ('destination') THEN 1 ELSE 2 END,
CASE WHEN int_surface IN ('unpaved') THEN 0 ELSE 2 END
) AS roads_fill
Expand All @@ -932,25 +964,49 @@ Layer:
<<: *osm2pgsql
table: |-
(SELECT
DISTINCT on (p.way)
p.way AS way, l.highway AS int_tc_type,
CASE WHEN l.service IN ('parking_aisle', 'drive-through', 'driveway') THEN 'INT-minor'::text
ELSE 'INT-normal'::text END AS int_tc_service
FROM planet_osm_point p
JOIN planet_osm_line l
ON ST_DWithin(p.way, l.way, 0.1)
JOIN (VALUES
('tertiary', 1),
('unclassified', 2),
('residential', 3),
('living_street', 4),
('service', 5),
('track', 6)
) AS v (highway, prio)
ON v.highway=l.highway
WHERE p.highway = 'turning_circle' OR p.highway = 'turning_loop'
ORDER BY p.way, v.prio
) AS turning_circle_fill
way,
feature,
int_tc_type,
int_surface,
int_tc_service
FROM
(SELECT DISTINCT on (p.way)
p.way AS way,
NULL::TEXT AS feature,
l.highway AS int_tc_type,
CASE
WHEN surface IN ('unpaved', 'compacted', 'dirt', 'earth', 'fine_gravel', 'grass', 'grass_paver', 'gravel', 'ground', 'mud', 'pebblestone', 'salt', 'sand', 'woodchips', 'clay') THEN 'unpaved'
WHEN surface IN ('paved', 'asphalt', 'cobblestone', 'cobblestone:flattened', 'sett', 'concrete', 'concrete:lanes', 'concrete:plates', 'paving_stones', 'metal', 'wood') THEN 'paved'
ELSE NULL
END AS int_surface,
CASE
WHEN l.service IN ('parking_aisle', 'drive-through', 'driveway') THEN 'INT-minor'::text
ELSE 'INT-normal'::text
END AS int_tc_service
FROM planet_osm_point p
JOIN planet_osm_line l
ON ST_DWithin(p.way, l.way, 0.1)
JOIN (VALUES
('tertiary', 1),
('unclassified', 2),
('residential', 3),
('living_street', 4),
('service', 5),
('track', 6)
) AS v (highway, prio)
ON v.highway=l.highway
WHERE p.highway = 'turning_circle' OR p.highway = 'turning_loop'
ORDER BY p.way, v.prio
) AS turning_circle_fill_inner_query
UNION ALL
(SELECT
ST_MakeEnvelope(-20037508.342789244, -20037508.342789244, 20037508.342789244, 20037508.342789244, 900913) AS way,
'globalboundingbox' AS feature,
NULL AS int_tc_type,
NULL AS int_surface,
NULL AS int_tc_service
)
) AS turning_circle_fill_outer_query
properties:
minzoom: 15
- id: aerialways
Expand Down Expand Up @@ -988,11 +1044,21 @@ Layer:
WHEN surface IN ('paved', 'asphalt', 'cobblestone', 'cobblestone:flattened', 'sett', 'concrete', 'concrete:lanes',
'concrete:plates', 'paving_stones', 'metal', 'wood') THEN 'paved'
ELSE NULL
END AS int_surface
END AS int_surface,
z_order
FROM planet_osm_roads
WHERE highway IS NOT NULL
OR (railway IS NOT NULL AND railway != 'preserved'
AND (service IS NULL OR service NOT IN ('spur', 'siding', 'yard')))
UNION ALL
(SELECT
ST_MakeEnvelope(-20037508.342789244, -20037508.342789244, 20037508.342789244, 20037508.342789244, 900913) AS way,
'globalboundingbox' AS feature,
NULL AS int_tunnel,
NULL AS link,
NULL AS int_surface,
NULL AS z_order
)
ORDER BY
z_order
) AS roads_low_zoom
Expand Down Expand Up @@ -1075,6 +1141,34 @@ Layer:
WHERE bridge IN ('yes', 'boardwalk', 'cantilever', 'covered', 'low_water_crossing', 'movable', 'trestle', 'viaduct')
AND highway IS NOT NULL -- end of road select
UNION ALL
SELECT
ST_MakeEnvelope(-20037508.342789244, -20037508.342789244, 20037508.342789244, 20037508.342789244, 900913) AS way,
'globalboundingbox' AS feature,
NULL AS horse,
NULL AS foot,
NULL AS bicycle,
NULL AS tracktype,
NULL AS surface,
NULL AS access,
NULL AS construction,
NULL AS service,
NULL AS link,
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') -- end of road select
) AS roads
) AS layers_list
UNION ALL
SELECT
way,
'railway_' || (CASE WHEN railway = 'preserved' AND service IN ('spur', 'siding', 'yard') THEN 'INT-preserved-ssy'::text
Expand Down Expand Up @@ -1105,6 +1199,8 @@ Layer:
z_order,
CASE WHEN substring(feature for 8) = 'railway_' THEN 2 ELSE 1 END,
CASE WHEN feature IN ('railway_INT-preserved-ssy', 'railway_INT-spur-siding-yard', 'railway_tram-service') THEN 0 ELSE 1 END,
CASE WHEN feature IN ('highway_road') THEN 0 ELSE 1 END,
CASE WHEN feature IN ('highway_platform', 'railway_platform') THEN 0 ELSE 1 END,
CASE WHEN access IN ('no', 'private') THEN 0 WHEN access IN ('destination') THEN 1 ELSE 2 END,
CASE WHEN int_surface IN ('unpaved') THEN 0 ELSE 2 END
) AS bridges
Expand Down Expand Up @@ -1148,13 +1244,37 @@ Layer:
<<: *osm2pgsql
table: |-
(SELECT
way,
feature,
aeroway,
bridge,
int_surface
FROM
(SELECT
way,
NULL as feature,
aeroway,
bridge IN ('yes', 'boardwalk', 'cantilever', 'covered', 'low_water_crossing', 'movable', 'trestle', 'viaduct') AS bridge
bridge IN ('yes', 'boardwalk', 'cantilever', 'covered', 'low_water_crossing', 'movable', 'trestle', 'viaduct') AS bridge,
CASE WHEN surface IN ('unpaved', 'compacted', 'dirt', 'earth', 'fine_gravel', 'grass', 'grass_paver', 'gravel', 'ground',
'mud', 'pebblestone', 'salt', 'sand', 'woodchips', 'clay') THEN 'unpaved'
WHEN surface IN ('paved', 'asphalt', 'cobblestone', 'cobblestone:flattened', 'sett', 'concrete', 'concrete:lanes',
'concrete:plates', 'paving_stones', 'metal', 'wood') THEN 'paved'
ELSE NULL
END AS int_surface
FROM planet_osm_line
WHERE aeroway IN ('runway', 'taxiway')
UNION ALL
(SELECT
ST_MakeEnvelope(-20037508.342789244, -20037508.342789244, 20037508.342789244, 20037508.342789244, 900913) AS way,
'globalboundingbox' AS feature,
NULL AS aeroway,
NULL AS bridge,
NULL AS int_surface
)
) AS features
ORDER BY bridge NULLS FIRST,
CASE WHEN aeroway = 'runway' THEN 10 ELSE 0 END
CASE WHEN aeroway = 'runway' THEN 10 ELSE 0 END,
CASE WHEN int_surface IN ('unpaved') THEN 0 ELSE 2 END
) AS aeroways
properties:
minzoom: 11
Expand Down
Loading