Skip to content

Commit

Permalink
move danger_area into landuse-overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
jragusa committed Oct 21, 2018
1 parent 6ac2d9c commit 52085d3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
16 changes: 6 additions & 10 deletions landcover.mss
Original file line number Diff line number Diff line change
Expand Up @@ -257,15 +257,6 @@
[way_pixels >= 64] { polygon-gamma: 0.3; }
}

[feature = 'military_danger_area'][zoom >= 9] {
polygon-pattern-file: url('symbols/danger_red_hatch.png');
polygon-pattern-alignment: global;
line-color: @military;
line-width: 2.0;
line-offset: -1.0;
line-opacity: 0.2;
}

[feature = 'leisure_park'] {
[zoom >= 10] {
polygon-fill: @park;
Expand Down Expand Up @@ -775,14 +766,19 @@

#landuse-overlay {
[landuse = 'military'][zoom >= 8][way_pixels > 900],
[landuse = 'military'][zoom >= 13] {
[landuse = 'military'][zoom >= 13],
[military = 'danger_area'][zoom >= 9] {
polygon-pattern-file: url('symbols/military_red_hatch.png');
polygon-pattern-alignment: global;
line-color: @military;
line-opacity: 0.24;
line-width: 1.0;
line-offset: -0.5;
[zoom >= 15] {
[military = 'danger_area'][zoom >= 9] {
polygon-pattern-file: url('symbols/danger_red_hatch.png');
line-opacity: 0.2;
}
line-width: 2;
line-offset: -1.0;
}
Expand Down
14 changes: 9 additions & 5 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,17 @@ Layer:
table: |-
(SELECT
way, name, way_pixels, religion,
COALESCE(wetland, landuse, "natural") AS feature
COALESCE(wetland, landuse, military, "natural") AS feature
FROM (SELECT
way, COALESCE(name, '') AS name, religion,
('landuse_' || (CASE WHEN landuse IN ('forest', 'military', 'farmland', 'residential', 'commercial', 'retail', 'industrial', 'meadow') THEN landuse ELSE NULL END)) AS landuse,
('military_' || (CASE WHEN military IN ('danger_area') THEN military ELSE NULL END)) AS military,
('natural_' || (CASE WHEN "natural" IN ('wood', 'sand', 'scree', 'shingle', 'bare_rock', 'heath', 'grassland') 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
FROM planet_osm_polygon
WHERE (landuse IN ('forest', 'military', 'farmland', 'residential', 'commercial', 'retail', 'industrial', 'meadow')
OR military IN ('danger_area')
OR "natural" IN ('wood', 'wetland', 'mud', 'sand', 'scree', 'shingle', 'bare_rock', 'heath', 'grassland'))
AND way_area > 1*!pixel_width!::real*!pixel_height!::real
AND building IS NULL
Expand All @@ -113,7 +115,7 @@ Layer:
table: |-
(SELECT
way, name, religion, way_pixels,
COALESCE(aeroway, amenity, wetland, power, landuse, leisure, man_made, military, "natural", tourism, highway, railway) AS feature
COALESCE(aeroway, amenity, wetland, power, landuse, leisure, man_made, "natural", tourism, highway, railway) AS feature
FROM (SELECT
way, COALESCE(name, '') AS name,
('aeroway_' || (CASE WHEN aeroway IN ('apron', 'aerodrome') THEN aeroway ELSE NULL END)) AS aeroway,
Expand All @@ -129,7 +131,6 @@ Layer:
'golf_course', 'miniature_golf', 'sports_centre', 'stadium', 'pitch',
'track', 'dog_park', 'fitness_station') THEN leisure ELSE NULL END)) AS leisure,
('man_made_' || (CASE WHEN man_made IN ('works', 'wastewater_plant', 'water_works') THEN man_made ELSE NULL END)) AS man_made,
('military_' || (CASE WHEN military IN ('danger_area') THEN military ELSE NULL END)) AS military,
('natural_' || (CASE WHEN "natural" IN ('beach', 'shoal', 'heath', 'grassland', 'wood', 'sand', 'scree', 'shingle', 'bare_rock', 'scrub') THEN "natural" ELSE NULL END)) AS "natural",
('wetland_' || (CASE WHEN "natural" IN ('wetland', 'marsh', 'mud') THEN (CASE WHEN "natural" IN ('marsh', 'mud') THEN "natural" ELSE tags->'wetland' END) ELSE NULL END)) AS wetland,
('power_' || (CASE WHEN power IN ('station', 'sub_station', 'substation', 'generator') THEN power ELSE NULL END)) AS power,
Expand All @@ -146,7 +147,6 @@ Layer:
'grave_yard', 'place_of_worship', 'prison', 'clinic', 'ferry_terminal', 'marketplace', 'community_centre', 'social_facility',
'arts_centre', 'parking_space', 'bus_station', 'fire_station', 'police')
OR man_made IN ('works', 'wastewater_plant','water_works')
OR military IN ('danger_area')
OR "natural" IN ('beach', 'shoal', 'heath', 'mud', 'marsh', 'wetland', 'grassland', 'wood', 'sand', 'scree', 'shingle', 'bare_rock', 'scrub')
OR power IN ('station', 'sub_station', 'substation', 'generator')
OR tourism IN ('camp_site', 'caravan_site', 'picnic_site')
Expand Down Expand Up @@ -538,9 +538,11 @@ Layer:
(SELECT
way,
landuse,
way_area/NULLIF(!pixel_width!::real*!pixel_height!::real,0) AS way_pixels
way_area/NULLIF(!pixel_width!::real*!pixel_height!::real,0) AS way_pixels,
military
FROM planet_osm_polygon
WHERE landuse = 'military'
OR military = 'danger_area'
AND building IS NULL
) AS landuse_overlay
properties:
Expand Down Expand Up @@ -1997,6 +1999,7 @@ Layer:
way_area/NULLIF(!pixel_width!::real*!pixel_height!::real,0) AS way_pixels,
COALESCE(
'landuse_' || CASE WHEN landuse IN ('forest', 'military', 'farmland') THEN landuse ELSE NULL END,
'military_' || CASE WHEN military IN ('danger_area') THEN military ELSE NULL END,
'natural_' || CASE WHEN "natural" IN ('wood', 'glacier', 'sand', 'scree', 'shingle', 'bare_rock',
'water', 'bay', 'strait') THEN "natural" ELSE NULL END,
'place_' || CASE WHEN place IN ('island') THEN place ELSE NULL END,
Expand All @@ -2007,6 +2010,7 @@ Layer:
CASE WHEN building = 'no' OR building IS NULL THEN 'no' ELSE 'yes' END AS is_building -- always no with the where conditions
FROM planet_osm_polygon
WHERE (landuse IN ('forest', 'military', 'farmland')
OR military IN ('danger_area')
OR "natural" IN ('wood', 'glacier', 'sand', 'scree', 'shingle', 'bare_rock', 'water', 'bay', 'strait')
OR "place" IN ('island')
OR boundary IN ('national_park')
Expand Down

0 comments on commit 52085d3

Please sign in to comment.