From 008f155c5b3818f4fc2f7d71c88bca5958fc860f Mon Sep 17 00:00:00 2001 From: jeisenbe <42757252+jeisenbe@users.noreply.github.com> Date: Tue, 16 Apr 2019 06:21:37 +0900 Subject: [PATCH] Reorder layers to render ocean and water areas above water lines and 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 --- landcover.mss | 23 +++---- project.mml | 163 +++++++++++++++++++++++++------------------------- 2 files changed, 94 insertions(+), 92 deletions(-) diff --git a/landcover.mss b/landcover.mss index f87140b9a8..f3d4251704 100644 --- a/landcover.mss +++ b/landcover.mss @@ -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] { @@ -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; diff --git a/project.mml b/project.mml index ab1f7c2497..983e864b8f 100644 --- a/project.mml +++ b/project.mml @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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