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

Use a random symbology for forests v1.1 #1728

Merged
merged 3 commits into from
Aug 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
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
41 changes: 3 additions & 38 deletions amenity-points.mss
Original file line number Diff line number Diff line change
Expand Up @@ -1145,24 +1145,6 @@
text-placement: interior;
}

[feature = 'natural_wood'][is_building = 'no'] {
[zoom >= 8][way_pixels > 3000],
[zoom >= 17] {
text-name: "[name]";
text-size: @landcover-font-size;
[way_pixels > 12000] { text-size: @landcover-font-size-big; }
[way_pixels > 48000] { text-size: @landcover-font-size-bigger; }
text-fill: darken(@wood, 40%);
text-face-name: @landcover-face-name;
text-halo-radius: 1;
text-halo-fill: rgba(255,255,255,0.6);
text-wrap-width: @landcover-wrap-width-size;
[way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; }
[way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; }
text-placement: interior;
}
}

[feature = 'natural_peak'][zoom >= 13],
[feature = 'natural_volcano'][zoom >= 13],
[feature = 'natural_saddle'][zoom >= 15],
Expand Down Expand Up @@ -1492,6 +1474,7 @@
}

[feature = 'landuse_meadow'][is_building = 'no'],
[feature = 'natural_grassland'][is_building = 'no'],
[feature = 'landuse_grass'][is_building = 'no'] {
[zoom >= 10][way_pixels > 3000],
[zoom >= 17] {
Expand Down Expand Up @@ -1528,14 +1511,15 @@
}
}

[feature = 'natural_wood'][is_building = 'no'],
[feature = 'landuse_forest'][is_building = 'no'] {
[zoom >= 8][way_pixels > 3000],
[zoom >= 17] {
text-name: "[name]";
text-size: @landcover-font-size;
[way_pixels > 12000] { text-size: @landcover-font-size-big; }
[way_pixels > 48000] { text-size: @landcover-font-size-bigger; }
text-fill: darken(@forest, 30%);
text-fill: @forest-text;
text-face-name: @landcover-face-name;
text-halo-radius: 1;
text-halo-fill: rgba(255,255,255,0.6);
Expand Down Expand Up @@ -2130,25 +2114,6 @@
}
}


[feature = 'natural_grassland'][is_building = 'no'] {
[zoom >= 10][way_pixels > 3000],
[zoom >= 17] {
text-name: "[name]";
text-size: @landcover-font-size;
[way_pixels > 12000] { text-size: @landcover-font-size-big; }
[way_pixels > 48000] { text-size: @landcover-font-size-bigger; }
text-fill: darken(@grass, 50%);
text-face-name: @landcover-face-name;
text-halo-radius: 1;
text-halo-fill: rgba(255,255,255,0.6);
text-wrap-width: @landcover-wrap-width-size;
[way_pixels > 12000] {text-wrap-width: @landcover-wrap-width-size-big; }
[way_pixels > 48000] {text-wrap-width: @landcover-wrap-width-size-bigger; }
text-placement: interior;
}
}

[feature = 'natural_scrub'][is_building = 'no'] {
[zoom >= 10][way_pixels > 3000],
[zoom >= 17] {
Expand Down
73 changes: 47 additions & 26 deletions landcover.mss
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// --- Parks, woods, other green things ---

@forest: #a0cf85;
@grass: #cdebb0; // also meadow, common, garden, village_green, conservation
@golf_course: #b5e3b5;
@park: #cdf7c9; // also recreation_ground
@wood: #aed1a0;
@scrub: #b5e3b5;
@forest: #add19e; // Lch(80,30,135)
@forest-text: #46673b; // Lch(40,30,135)
@park: #c8facc; // Lch(94,30,145) also recreation_ground
@orchard: #aedfa3;

// --- sports ---
Expand Down Expand Up @@ -210,6 +210,7 @@
}

[feature = 'landuse_meadow'],
[feature = 'natural_grassland'],
[feature = 'landuse_grass'] {
[zoom >= 10] {
polygon-fill: @grass;
Expand Down Expand Up @@ -260,18 +261,13 @@
}
}

[feature = 'landuse_forest'] {
[feature = 'landuse_forest'],
[feature = 'natural_wood'] {
[zoom >= 8] {
polygon-fill: @forest;
[way_pixels >= 4] { polygon-gamma: 0.75; }
[way_pixels >= 64] { polygon-gamma: 0.3; }
}
[zoom >= 14] {
polygon-pattern-file: url('symbols/forest.png');
[way_pixels >= 4] { polygon-pattern-gamma: 0.75; }
[way_pixels >= 64] { polygon-pattern-gamma: 0.3; }
}

}

[feature = 'landuse_farmyard'][zoom >= 10] {
Expand Down Expand Up @@ -388,14 +384,6 @@
}
}

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

[feature = 'natural_bare_rock'][zoom >= 9] {
polygon-fill: @bare_ground;
[way_pixels >= 4] { polygon-gamma: 0.75; }
Expand Down Expand Up @@ -433,12 +421,6 @@
[way_pixels >= 64] { polygon-gamma: 0.3; }
}

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

[feature = 'natural_scrub'] {
[zoom >= 10] {
polygon-fill: @scrub;
Expand All @@ -453,7 +435,7 @@
}

[feature = 'wetland_swamp'][zoom >= 8] {
polygon-fill: @wood;
polygon-fill: @forest;
[way_pixels >= 4] { polygon-gamma: 0.75; }
[way_pixels >= 64] { polygon-gamma: 0.3; }
}
Expand Down Expand Up @@ -585,8 +567,47 @@
}
}

#landcover-area-symbols {
[int_wetland != null][zoom >= 10] {
polygon-pattern-file: url('symbols/wetland.png');
polygon-pattern-alignment: global;
}
[zoom >= 14] {
[int_wetland = 'marsh'],
[int_wetland = 'saltmarsh'],
[int_wetland = 'wet_meadow'],
[int_wetland = 'fen'] {
polygon-pattern-file: url('symbols/wetland_marsh.png');
polygon-pattern-alignment: global;
}
[int_wetland = 'reedbed'] {
polygon-pattern-file: url('symbols/wetland_reed.png');
polygon-pattern-alignment: global;
}
[int_wetland = 'mangrove'] {
polygon-pattern-file: url('symbols/wetland_mangrove.png');
polygon-pattern-alignment: global;
}
[int_wetland = 'swamp'] {
polygon-pattern-file: url('symbols/wetland_swamp.png');
polygon-pattern-alignment: global;
}
[int_wetland = 'bog'],
[int_wetland = 'string_bog'] {
polygon-pattern-file: url('symbols/wetland_bog.png');
polygon-pattern-alignment: global;
}
}
//Also landuse = forest, converted in the SQL
[natural = 'wood'][zoom >= 13]::wood {
polygon-pattern-file: url('symbols/forest.png'); // Lch(55,30,135)
polygon-pattern-alignment: global;
opacity: 0.4; // The entire layer has opacity to handle overlapping forests
}
}

#landuse-overlay {
[landuse = 'military'][zoom >= 10]::landuse {
[landuse = 'military'][zoom >= 10] {
polygon-pattern-file: url('symbols/military_red_hatch.png');
polygon-pattern-alignment: global;
line-color: @military;
Expand Down
6 changes: 3 additions & 3 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,15 @@
"advanced": {}
},
{
"name": "water-areas-overlay",
"name": "landcover-area-symbols",
"srs-name": "900913",
"geometry": "polygon",
"class": "",
"id": "water-areas-overlay",
"id": "landcover-area-symbols",
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
"Datasource": {
"extent": "-20037508,-20037508,20037508,20037508",
"table": "(SELECT\n way,\n CASE WHEN \"natural\" IN ('marsh', 'mud') THEN \"natural\" ELSE wetland END AS int_wetland\n FROM planet_osm_polygon\n WHERE \"natural\" IN ('marsh', 'mud', 'wetland')\n AND building IS NULL\n AND way_area > 0.01*!pixel_width!::real*!pixel_height!::real\n ORDER BY z_order, way_area DESC\n) AS water_areas_overlay",
"table": "(SELECT\n way,\n COALESCE(\"natural\", CASE WHEN landuse = 'forest' THEN 'wood' ELSE NULL END) AS \"natural\",\n CASE WHEN \"natural\" IN ('marsh', 'mud') \n THEN \"natural\" \n ELSE CASE WHEN (\"natural\" = 'wetland' AND wetland IS NULL) \n THEN 'wetland' \n ELSE CASE WHEN (\"natural\" = 'wetland')\n THEN wetland\n ELSE NULL\n END \n END\n END AS int_wetland\n FROM planet_osm_polygon\n WHERE (\"natural\" IN ('marsh', 'mud', 'wetland', 'wood') OR landuse = 'forest')\n AND building IS NULL\n AND way_area > 0.01*!pixel_width!::real*!pixel_height!::real\n ORDER BY z_order, way_area DESC\n) AS landcover_area_symbols",
"geometry_field": "way",
"type": "postgis",
"key_field": "",
Expand Down
20 changes: 15 additions & 5 deletions project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ Layer:
properties:
minzoom: 4
advanced: {}
- id: "water-areas-overlay"
name: "water-areas-overlay"
- id: "landcover-area-symbols"
name: "landcover-area-symbols"
class: ""
geometry: "polygon"
<<: *extents
Expand All @@ -270,13 +270,23 @@ Layer:
table: |-
(SELECT
way,
CASE WHEN "natural" IN ('marsh', 'mud') THEN "natural" ELSE wetland END AS int_wetland
COALESCE("natural", CASE WHEN landuse = 'forest' THEN 'wood' ELSE NULL END) AS "natural",
CASE WHEN "natural" IN ('marsh', 'mud')
THEN "natural"
ELSE CASE WHEN ("natural" = 'wetland' AND wetland IS NULL)
THEN 'wetland'
ELSE CASE WHEN ("natural" = 'wetland')
THEN wetland
ELSE NULL
END
END
END AS int_wetland
FROM planet_osm_polygon
WHERE "natural" IN ('marsh', 'mud', 'wetland')
WHERE ("natural" IN ('marsh', 'mud', 'wetland', 'wood') OR landuse = 'forest')
AND building IS NULL
AND way_area > 0.01*!pixel_width!::real*!pixel_height!::real
ORDER BY z_order, way_area DESC
) AS water_areas_overlay
) AS landcover_area_symbols
properties:
minzoom: 10
advanced: {}
Expand Down
Binary file modified symbols/forest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 0 additions & 33 deletions water.mss
Original file line number Diff line number Diff line change
Expand Up @@ -53,39 +53,6 @@
}
}

#water-areas-overlay {
[zoom >= 10] {
polygon-pattern-file: url('symbols/wetland.png');
polygon-pattern-alignment: global;
}
[zoom >= 14] {
[int_wetland = 'marsh'],
[int_wetland = 'saltmarsh'],
[int_wetland = 'wet_meadow'],
[int_wetland = 'fen'] {
polygon-pattern-file: url('symbols/wetland_marsh.png');
polygon-pattern-alignment: global;
}
[int_wetland = 'reedbed'] {
polygon-pattern-file: url('symbols/wetland_reed.png');
polygon-pattern-alignment: global;
}
[int_wetland = 'mangrove'] {
polygon-pattern-file: url('symbols/wetland_mangrove.png');
polygon-pattern-alignment: global;
}
[int_wetland = 'swamp'] {
polygon-pattern-file: url('symbols/wetland_swamp.png');
polygon-pattern-alignment: global;
}
[int_wetland = 'bog'],
[int_wetland = 'string_bog'] {
polygon-pattern-file: url('symbols/wetland_bog.png');
polygon-pattern-alignment: global;
}
}
}

#water-lines-casing {
[waterway = 'stream'],
[waterway = 'ditch'],
Expand Down