Skip to content

Commit

Permalink
Reorder layers to render ocean and water areas above water lines and …
Browse files Browse the repository at this point in the history
…landcover (#3738)

* Change layering, move ocean and water above landcover

Icesheet polygons are moved before water lines, which are now before water-areas, and ocean polygons are after these. Landcover is now first.
Also, springs are moved after water-barriers, marinas are moved before the barriers, and necountries is moved to immediatley before admin-low-zoom

* Move mud to landcover symbols layer, after water-areas

By moving the natural=mud background color to the landcover symbols layer, it will render over water of all types, and will display the same over ocean, rivers or lakes
  • Loading branch information
jeisenbe authored and imagico committed Apr 15, 2019
1 parent f381b1b commit 008f155
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 92 deletions.
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

0 comments on commit 008f155

Please sign in to comment.