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

Move danger_area into landuse-overlay #3469

Merged
merged 2 commits into from
Oct 29, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need military=danger_area in this layer. The layer landuse-overlay also works for lowzoom rendering.

We can even remove the landuse=military from this layer: the style for #landcover-low-zoom does not seem to use landuse=military.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe swap these lines for clarity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

FROM planet_osm_polygon
WHERE landuse = 'military'
OR military = 'danger_area'
AND building IS NULL
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In SQL, AND has precedence over OR, so this will be parsed as landuse = 'military' OR (military = 'danger_area' AND building IS NULL). The intended meaning is of course (landuse = 'military' OR military = 'danger_area') AND building IS NULL so we are missing a pair of brackets here.

) 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