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

Reorder layers to render ocean and water areas above water lines and landcover #3738

Merged
merged 2 commits into from
Apr 15, 2019
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
23 changes: 12 additions & 11 deletions landcover.mss
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,6 @@
::upper-mid-zoom[zoom >= 12][zoom < 13],
::high-zoom[zoom >= 13] {

::first {
[feature = 'wetland_mud'],
[feature = 'wetland_tidalflat'] {
[zoom >= 5] {
polygon-fill: @mud;
[way_pixels >= 4] { polygon-gamma: 0.75; }
[way_pixels >= 64] { polygon-gamma: 0.3; }
}
}
}

[feature = 'leisure_swimming_pool'][zoom >= 14] {
polygon-fill: @water-color;
[zoom >= 17] {
Expand Down Expand Up @@ -718,6 +707,18 @@
}

#landcover-area-symbols {

::first {
[natural = 'mud'],
[int_wetland = 'tidalflat'] {
[zoom >= 9] {
polygon-fill: @mud;
[way_pixels >= 4] { polygon-gamma: 0.75; }
[way_pixels >= 64] { polygon-gamma: 0.3; }
}
}
}

[natural = 'sand'][zoom >= 5] {
polygon-pattern-file: url('symbols/beach.png');
polygon-pattern-alignment: global;
Expand Down
163 changes: 82 additions & 81 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -54,33 +54,6 @@ Stylesheet:
- admin.mss
- addressing.mss
Layer:
- id: ocean-lz
geometry: polygon
class: ocean
<<: *extents
Datasource:
file: data/simplified-water-polygons-split-3857/simplified_water_polygons.shp
type: shape
properties:
maxzoom: 9
- id: ocean
geometry: polygon
class: ocean
<<: *extents
Datasource:
file: data/water-polygons-split-3857/water_polygons.shp
type: shape
properties:
minzoom: 10
- id: necountries
geometry: linestring
<<: *extents84
Datasource:
file: data/ne_110m_admin_0_boundary_lines_land/ne_110m_admin_0_boundary_lines_land.shp
type: shape
properties:
minzoom: 1
maxzoom: 3
- id: landcover-low-zoom
geometry: polygon
<<: *extents
Expand Down Expand Up @@ -176,6 +149,14 @@ Layer:
) AS landcover_line
properties:
minzoom: 14
- id: icesheet-poly
geometry: polygon
<<: *extents
Datasource:
file: data/antarctica-icesheet-polygons-3857/icesheet_polygons.shp
type: shape
properties:
minzoom: 5
- id: water-lines-casing
geometry: linestring
<<: *extents
Expand Down Expand Up @@ -212,14 +193,29 @@ Layer:
properties:
minzoom: 8
maxzoom: 11
- id: icesheet-poly
geometry: polygon
- id: water-lines
class: water-lines
geometry: linestring
<<: *extents
Datasource:
file: data/antarctica-icesheet-polygons-3857/icesheet_polygons.shp
type: shape
<<: *osm2pgsql
table: |-
(SELECT
way,
waterway,
name,
CASE WHEN tags->'intermittent' IN ('yes')
OR tags->'seasonal' IN ('yes', 'spring', 'summer', 'autumn', 'winter', 'wet_season', 'dry_season')
THEN 'yes' ELSE 'no' END AS int_intermittent,
CASE WHEN tunnel IN ('yes', 'culvert') THEN 'yes' ELSE 'no' END AS int_tunnel,
'no' AS bridge
FROM planet_osm_line
WHERE waterway IN ('river', 'canal', 'stream', 'drain', 'ditch', 'wadi')
AND (bridge IS NULL OR bridge NOT IN ('yes', 'aqueduct'))
ORDER BY COALESCE(layer,0)
) AS water_lines
properties:
minzoom: 5
minzoom: 12
- id: water-areas
geometry: polygon
<<: *extents
Expand Down Expand Up @@ -248,6 +244,24 @@ Layer:
) AS water_areas
properties:
minzoom: 0
- id: ocean-lz
geometry: polygon
class: ocean
<<: *extents
Datasource:
file: data/simplified-water-polygons-split-3857/simplified_water_polygons.shp
type: shape
properties:
maxzoom: 9
- id: ocean
geometry: polygon
class: ocean
<<: *extents
Datasource:
file: data/water-polygons-split-3857/water_polygons.shp
type: shape
properties:
minzoom: 10
- id: landcover-area-symbols
geometry: polygon
<<: *extents
Expand All @@ -267,7 +281,8 @@ Layer:
END
END
END AS int_wetland,
tags->'leaf_type' AS leaf_type
tags->'leaf_type' AS leaf_type,
way_area/NULLIF(POW(!scale_denominator!*0.001*0.28,2),0) AS way_pixels
FROM planet_osm_polygon
WHERE ("natural" IN ('marsh', 'mud', 'wetland', 'wood', 'beach', 'shoal', 'reef', 'scrub', 'sand') OR landuse = 'forest')
AND building IS NULL
Expand All @@ -284,55 +299,19 @@ Layer:
type: shape
properties:
minzoom: 5
- id: springs
geometry: point
- id: marinas-area
geometry: polygon
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
"natural"
FROM
(SELECT
ST_PointOnSurface(way) AS way,
"natural"
FROM planet_osm_polygon
WHERE way && !bbox!
UNION ALL
SELECT
way,
"natural"
FROM planet_osm_point
WHERE way && !bbox!
) _
WHERE "natural" IN ('spring')
) AS springs
way
FROM planet_osm_polygon
WHERE leisure = 'marina'
) AS marinas_area
properties:
minzoom: 14
- id: water-lines
class: water-lines
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
waterway,
name,
CASE WHEN tags->'intermittent' IN ('yes')
OR tags->'seasonal' IN ('yes', 'spring', 'summer', 'autumn', 'winter', 'wet_season', 'dry_season')
THEN 'yes' ELSE 'no' END AS int_intermittent,
CASE WHEN tunnel IN ('yes', 'culvert') THEN 'yes' ELSE 'no' END AS int_tunnel,
'no' AS bridge
FROM planet_osm_line
WHERE waterway IN ('river', 'canal', 'stream', 'drain', 'ditch', 'wadi')
AND (bridge IS NULL OR bridge NOT IN ('yes', 'aqueduct'))
ORDER BY COALESCE(layer,0)
) AS water_lines
properties:
minzoom: 12
- id: water-barriers-line
geometry: linestring
<<: *extents
Expand Down Expand Up @@ -363,17 +342,30 @@ Layer:
) AS water_barriers_poly
properties:
minzoom: 13
- id: marinas-area
geometry: polygon
- id: springs
geometry: point
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way
FROM planet_osm_polygon
WHERE leisure = 'marina'
) AS marinas_area
way,
"natural"
FROM
(SELECT
ST_PointOnSurface(way) AS way,
"natural"
FROM planet_osm_polygon
WHERE way && !bbox!
UNION ALL
SELECT
way,
"natural"
FROM planet_osm_point
WHERE way && !bbox!
) _
WHERE "natural" IN ('spring')
) AS springs
properties:
minzoom: 14
- id: piers-poly
Expand Down Expand Up @@ -1152,6 +1144,15 @@ Layer:
) AS aeroways
properties:
minzoom: 11
- id: necountries
geometry: linestring
<<: *extents84
Datasource:
file: data/ne_110m_admin_0_boundary_lines_land/ne_110m_admin_0_boundary_lines_land.shp
type: shape
properties:
minzoom: 1
maxzoom: 3
- id: admin-low-zoom
geometry: linestring
<<: *extents
Expand Down