Skip to content

Commit

Permalink
Use a random symbology for forests
Browse files Browse the repository at this point in the history
This adds a random symbology for forests, lightens forests, and
unifies natural=wood and landuse=forest rendering.

Using http://www.imagico.de/map/jsdotpattern.php a random pattern
was generated from the SVG

    <path d="m 3.5,0 -3.5,3.5 0,0.5 0.5,0 2.5,-2.5 0,2
    -3,3 0,0.5 0.5,0 2.5,-2.5 0,5.5
    1,0 0,-5.5 2.5,2.5 0.5,0 0,-0.5 -3,-3 0,-2
    2.5,2.5 0.5,0 0,-0.5 z" fill="rgb(58,135,39)"/>

    <path d="m 10.5,0 a 2.5,3 0 0,1 0,6 l 0,-1
    a 1.5,2 0 0,0 0,-4
    a 1.5,2 0 0,0 0,4 l 0,1
    a 2.5,3 0 0,1 0,-6
    z" fill="rgb(58,135,39)"/>

This was then converted with GIMP into a PNG which Mapnik can use.

The forest fill was lightened, but there are now darker symbols on.

This necessitated adjusting the text colour for forests, which was
done in Lch colour space. The frequent symbols also required some
halo adjustments.

There are multiple interpretations in use of landuse=forest vs.
natural=wood. Rather than attempt to sort this out when the tagging
has not settled, the same appearance is used for both.

This commit doesn't use different symbologies for different types
of forests (mixed/coniferous/broad_leaved/palm) (gravitystorm#822), but that
can be considered later.

Fixes gravitystorm#938
Fixes forest part of gravitystorm#937
  • Loading branch information
pnorman committed Jan 18, 2015
1 parent eabf222 commit 15fb90b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 41 deletions.
23 changes: 3 additions & 20 deletions amenity-points.mss
Original file line number Diff line number Diff line change
Expand Up @@ -700,24 +700,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'],
[feature = 'natural_volcano'] {
[zoom >= 13] {
Expand Down Expand Up @@ -1129,17 +1111,18 @@
}
}

[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);
text-halo-fill: @forest-text-halo;
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; }
Expand Down
29 changes: 11 additions & 18 deletions landcover.mss
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// --- Parks, woods, other green things ---

@forest: #a0cf85;
@forest: #b2d6a3; // Lch(82,30,135)
@forest-text: #4e843e; // Lch(50,45,135) (mix of @forest and polygon-pattern)
@forest-text-halo: #d0f5c1; // Lch(92.8, 30, 135)
@grass: #cfeca8; // also meadow, common, garden, village_green, conservation
@golf_course: #b5e3b5;
@park: #cdf7c9; // also recreation_ground
@wood: #aed1a0;
@vineyard: #b3e2a8;
@grassland: #c6e4b4;

Expand Down Expand Up @@ -250,18 +251,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 @@ -377,14 +373,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 @@ -546,13 +534,18 @@
}

#landuse-overlay {
[landuse = 'military'][zoom >= 10]::landuse {
[feature = 'military'][zoom >= 10] {
polygon-pattern-file: url('symbols/military_red_hatch.png');
polygon-pattern-alignment: global;
line-color: @military;
line-width: 3;
line-opacity: 0.329;
}
[feature = 'forest'][zoom >= 12] {
polygon-pattern-file: url('symbols/forest.png'); // Lch(50,60,135)
polygon-pattern-alignment: global;
opacity: 0.6; // The entire layer has opacity in case of overlapping forests
}
}

#cliffs {
Expand Down
2 changes: 1 addition & 1 deletion project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@
"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, landuse, leisure\n FROM planet_osm_polygon\n WHERE (landuse = 'military') AND building IS NULL\n) AS landuse_overlay",
"table": "(SELECT\n way, COALESCE(landuse, CASE WHEN \"natural\" = 'wood' THEN 'forest' END) AS feature\n FROM planet_osm_polygon\n WHERE (landuse IN ('military', 'forest') OR \"natural\" = 'wood')\n AND building IS NULL\n) AS landuse_overlay",
"geometry_field": "way",
"type": "postgis",
"key_field": "",
Expand Down
5 changes: 3 additions & 2 deletions project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -503,9 +503,10 @@ Layer:
<<: *osm2pgsql
table: |-
(SELECT
way, landuse, leisure
way, COALESCE(landuse, CASE WHEN "natural" = 'wood' THEN 'forest' END) AS feature
FROM planet_osm_polygon
WHERE (landuse = 'military') AND building IS NULL
WHERE (landuse IN ('military', 'forest') OR "natural" = 'wood')
AND building IS NULL
) AS landuse_overlay
advanced: {}
- id: "line-barriers"
Expand Down
Binary file modified symbols/forest.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 15fb90b

Please sign in to comment.