Skip to content

Commit

Permalink
Showing natural areas on z5+ (#3458)
Browse files Browse the repository at this point in the history
  • Loading branch information
kocio-pl committed Nov 17, 2018
1 parent fdf944d commit 2e87138
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 30 deletions.
34 changes: 17 additions & 17 deletions landcover.mss
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
::first {
[feature = 'wetland_mud'],
[feature = 'wetland_tidalflat'] {
[zoom >= 9] {
[zoom >= 5] {
polygon-fill: @mud;
[way_pixels >= 4] { polygon-gamma: 0.75; }
[way_pixels >= 64] { polygon-gamma: 0.3; }
Expand Down Expand Up @@ -142,7 +142,7 @@
}

[feature = 'landuse_vineyard'] {
[zoom >= 10] {
[zoom >= 5] {
polygon-fill: @orchard;
[way_pixels >= 4] { polygon-gamma: 0.75; }
[way_pixels >= 64] { polygon-gamma: 0.3; }
Expand All @@ -156,7 +156,7 @@
}

[feature = 'landuse_orchard'] {
[zoom >= 10] {
[zoom >= 5] {
polygon-fill: @orchard;
[way_pixels >= 4] { polygon-gamma: 0.75; }
[way_pixels >= 64] { polygon-gamma: 0.3; }
Expand Down Expand Up @@ -306,7 +306,7 @@

[feature = 'landuse_forest'],
[feature = 'natural_wood'] {
[zoom >= 8] {
[zoom >= 5] {
polygon-fill: @forest;
[way_pixels >= 4] { polygon-gamma: 0.75; }
[way_pixels >= 64] { polygon-gamma: 0.3; }
Expand All @@ -328,7 +328,7 @@

[feature = 'landuse_farmland'],
[feature = 'landuse_greenhouse_horticulture'] {
[zoom >= 8] {
[zoom >= 5] {
polygon-fill: @farmland;
[zoom >= 16] {
line-width: .5;
Expand All @@ -339,8 +339,8 @@
}
}

[feature = 'natural_grassland'][zoom >= 8],
[feature = 'landuse_meadow'][zoom >= 8],
[feature = 'natural_grassland'][zoom >= 5],
[feature = 'landuse_meadow'][zoom >= 5],
[feature = 'landuse_grass'][zoom >= 10],
[feature = 'landuse_village_green'][zoom >= 10],
[feature = 'leisure_common'][zoom >= 10] {
Expand Down Expand Up @@ -482,7 +482,7 @@
}
}

[feature = 'natural_bare_rock'][zoom >= 8] {
[feature = 'natural_bare_rock'][zoom >= 5] {
polygon-fill: @bare_ground;
polygon-pattern-file: url('symbols/rock_overlay.png');
[way_pixels >= 4] {
Expand All @@ -497,7 +497,7 @@

[feature = 'natural_scree'],
[feature = 'natural_shingle'] {
[zoom >= 9] {
[zoom >= 5] {
polygon-fill: @bare_ground;
[way_pixels >= 4] { polygon-gamma: 0.75; }
[way_pixels >= 64] { polygon-gamma: 0.3; }
Expand All @@ -509,33 +509,33 @@
}
}

[feature = 'natural_sand'][zoom >= 8] {
[feature = 'natural_sand'][zoom >= 5] {
polygon-fill: @sand;
[way_pixels >= 4] { polygon-gamma: 0.75; }
[way_pixels >= 64] { polygon-gamma: 0.3; }
}

[feature = 'natural_heath'][zoom >= 8] {
[feature = 'natural_heath'][zoom >= 5] {
polygon-fill: @heath;
[way_pixels >= 4] { polygon-gamma: 0.75; }
[way_pixels >= 64] { polygon-gamma: 0.3; }
}

[feature = 'natural_scrub'][zoom >= 10] {
[feature = 'natural_scrub'][zoom >= 5] {
polygon-fill: @scrub;
[way_pixels >= 4] { polygon-gamma: 0.75; }
[way_pixels >= 64] { polygon-gamma: 0.3; }
}

[feature = 'wetland_swamp'][zoom >= 8] {
[feature = 'wetland_swamp'][zoom >= 5] {
polygon-fill: @forest;
[way_pixels >= 4] { polygon-gamma: 0.75; }
[way_pixels >= 64] { polygon-gamma: 0.3; }
}

[feature = 'wetland_bog'],
[feature = 'wetland_string_bog'] {
[zoom >= 10] {
[zoom >= 5] {
polygon-fill: @heath;
[way_pixels >= 4] { polygon-gamma: 0.75; }
[way_pixels >= 64] { polygon-gamma: 0.3; }
Expand All @@ -545,7 +545,7 @@
[feature = 'wetland_wet_meadow'],
[feature = 'wetland_fen'],
[feature = 'wetland_marsh'] {
[zoom >= 10] {
[zoom >= 5] {
polygon-fill: @grass;
[way_pixels >= 4] { polygon-gamma: 0.75; }
[way_pixels >= 64] { polygon-gamma: 0.3; }
Expand Down Expand Up @@ -700,11 +700,11 @@
}

#landcover-area-symbols {
[natural = 'sand'][zoom >= 8] {
[natural = 'sand'][zoom >= 5] {
polygon-pattern-file: url('symbols/beach.png');
polygon-pattern-alignment: global;
}
[int_wetland != null][zoom >= 10] {
[int_wetland != null][zoom >= 5] {
polygon-pattern-file: url('symbols/wetland.png');
polygon-pattern-alignment: global;
}
Expand Down
21 changes: 11 additions & 10 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,22 @@ Layer:
COALESCE(wetland, landuse, "natural") AS feature
FROM (SELECT
way, COALESCE(name, '') AS name, religion,
('landuse_' || (CASE WHEN landuse IN ('forest', 'farmland', 'residential', 'commercial', 'retail', 'industrial', 'meadow') THEN landuse ELSE NULL END)) AS landuse,
('natural_' || (CASE WHEN "natural" IN ('wood', 'sand', 'scree', 'shingle', 'bare_rock', 'heath', 'grassland') THEN "natural" ELSE NULL END)) AS "natural",
('landuse_' || (CASE WHEN landuse IN ('forest', 'farmland', 'residential', 'commercial', 'retail', 'industrial',
'meadow', 'vineyard', 'orchard') THEN landuse ELSE NULL END)) AS landuse,
('natural_' || (CASE WHEN "natural" IN ('wood', 'sand', 'scree', 'shingle', 'bare_rock', 'heath', 'grassland', 'scrub') THEN "natural" ELSE NULL END)) AS "natural",
('wetland_' || (CASE WHEN "natural" IN ('wetland', 'mud') THEN (CASE WHEN "natural" IN ('mud') THEN "natural" ELSE tags->'wetland' END) ELSE NULL END)) AS wetland,
way_area/NULLIF(!pixel_width!::real*!pixel_height!::real,0) AS way_pixels,
way_area
FROM planet_osm_polygon
WHERE (landuse IN ('forest', 'farmland', 'residential', 'commercial', 'retail', 'industrial', 'meadow')
OR "natural" IN ('wood', 'wetland', 'mud', 'sand', 'scree', 'shingle', 'bare_rock', 'heath', 'grassland'))
AND way_area > 1*!pixel_width!::real*!pixel_height!::real
WHERE (landuse IN ('forest', 'farmland', 'residential', 'commercial', 'retail', 'industrial', 'meadow', 'vineyard', 'orchard')
OR "natural" IN ('wood', 'wetland', 'mud', 'sand', 'scree', 'shingle', 'bare_rock', 'heath', 'grassland', 'scrub'))
AND way_area > 0.01*!pixel_width!::real*!pixel_height!::real

This comment has been minimized.

Copy link
@szymone

szymone Jul 21, 2019

Why 1 has been changed to 0.01? As part of index optimization 0.01 has been replaced with 1 in this commit: 41939bc. Why now this change has been reverted, but only in this single line? And it's still in the latest version.

This comment has been minimized.

Copy link
@kocio-pl

kocio-pl Jul 21, 2019

Author Collaborator

This has been discussed here: #3458 (comment).

This comment has been minimized.

Copy link
@szymone

szymone Jul 21, 2019

Thanks, now it's clear. I've been testing this on z8, so I havn't noticed the difference clearly visible on lower zooms.

AND building IS NULL
) AS features
ORDER BY way_area DESC, feature
) AS landcover_low_zoom
properties:
minzoom: 7
minzoom: 5
maxzoom: 9
- id: landcover
geometry: polygon
Expand Down Expand Up @@ -214,7 +215,7 @@ Layer:
file: data/antarctica-icesheet-polygons-3857/icesheet_polygons.shp
type: shape
properties:
minzoom: 8
minzoom: 5
- id: water-areas
geometry: polygon
<<: *extents
Expand Down Expand Up @@ -270,15 +271,15 @@ Layer:
ORDER BY COALESCE(layer,0), way_area DESC
) AS landcover_area_symbols
properties:
minzoom: 8
minzoom: 5
- id: icesheet-outlines
geometry: linestring
<<: *extents
Datasource:
file: data/antarctica-icesheet-outlines-3857/icesheet_outlines.shp
type: shape
properties:
minzoom: 8
minzoom: 5
- id: springs
geometry: point
<<: *extents
Expand Down Expand Up @@ -547,7 +548,7 @@ Layer:
AND building IS NULL
) AS landuse_overlay
properties:
minzoom: 7
minzoom: 8
- id: tourism-boundary
geometry: polygon
<<: *extents
Expand Down
4 changes: 2 additions & 2 deletions shapefiles.mss
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
}

#icesheet-poly {
[zoom >= 8] {
[zoom >= 5] {
polygon-fill: @glacier;
}
}

#icesheet-outlines {
[zoom >= 8] {
[zoom >= 5] {
[ice_edge = 'ice_ocean'],
[ice_edge = 'ice_land'] {
line-width: 0.375;
Expand Down
2 changes: 1 addition & 1 deletion water.mss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#water-areas {
[natural = 'glacier']::natural {
[zoom >= 8] {
[zoom >= 5] {
line-width: 1.0;
line-color: @glacier-line;
polygon-fill: @glacier;
Expand Down

0 comments on commit 2e87138

Please sign in to comment.