Skip to content

Commit

Permalink
Add labels for rendered landuse and leisure polygons
Browse files Browse the repository at this point in the history
  • Loading branch information
mrwojo committed Feb 23, 2014
1 parent b0842bd commit 60ea62a
Show file tree
Hide file tree
Showing 3 changed files with 225 additions and 48 deletions.
229 changes: 223 additions & 6 deletions amenity-points.mss
@@ -1,3 +1,7 @@
@marina-text: #576ddf; // also swimming_pool
@military-text: #99001a;
@park-text: #2c4b2c;

.points {
[tourism = 'alpine_hut'][zoom >= 13]::tourism {
point-file: url('symbols/alpinehut.p.16.png');
Expand Down Expand Up @@ -561,15 +565,216 @@
}
}

/* Hmmm */
[point = 'yes'][leisure != '']::point,
[point = 'yes'][landuse != '']::point {
[leisure = 'swimming_pool']::leisure {
[zoom >= 17] {
text-name: "[name]";
text-size: 9;
text-fill: @marina-text;
text-face-name: @book-fonts;
text-halo-radius: 1;
text-wrap-width: 10;
text-placement: interior;
}
}

[leisure = 'sports_centre']::leisure,
[leisure = 'stadium']::leisure {
[zoom >= 15] {
text-name: "[name]";
text-size: 9;
text-fill: darken(@stadium, 30%);
text-face-name: @book-fonts;
text-halo-radius: 1;
text-wrap-width: 10;
text-placement: interior;
}
}

[leisure = 'playground']::leisure,
[leisure = 'park']::leisure,
[leisure = 'recreation_ground']::leisure,
[landuse = 'recreation_ground']::landuse,
[landuse = 'conservation']::landuse,
[landuse = 'village_green']::landuse,
[leisure = 'common']::leisure,
[leisure = 'garden']::leisure,
[leisure = 'golf_course']::leisure {
[way_area >= 150000][zoom >= 14],
[way_area >= 80000][zoom >= 15],
[way_area >= 20000][zoom >= 16],
[zoom >= 17] {
text-name: "[name]";
text-size: 11;
text-fill: @park-text;
text-face-name: @book-fonts;
text-halo-radius: 1;
text-halo-fill: rgba(255,255,255,0.6);
text-wrap-width: 30;
text-placement: interior;
}
}

[landuse = 'quarry']::landuse {
[zoom >= 15] {
text-name: "[name]";
text-size: 9;
text-fill: #000;
text-face-name: @book-fonts;
text-halo-radius: 1;
text-wrap-width: 10;
}
}

[landuse = 'vineyard']::landuse,
[landuse = 'orchard']::landuse {
[zoom >= 15] {
text-name: "[name]";
text-size: 9;
text-fill: darken(@vineyard, 50%);
text-face-name: @book-fonts;
// extra halo needed to overpower the cemetery polygon pattern
text-halo-radius: 1.5;
text-wrap-width: 10;
}
}

[landuse = 'cemetery']::landuse,
[landuse = 'grave_yard']::landuse {
[zoom >= 15] {
text-name: "[name]";
text-size: 9;
text-fill: darken(@cemetery, 50%);
text-face-name: @book-fonts;
// extra halo needed to overpower the cemetery polygon pattern
text-halo-radius: 1.5;
text-wrap-width: 10;
}
}

[landuse = 'residential']::landuse {
[zoom >= 15] {
text-name: "[name]";
text-size: 9;
text-fill: #000;
text-face-name: @book-fonts;
text-halo-radius: 2;
text-halo-radius: 1;
text-wrap-width: 10;
}
}

[landuse = 'garages']::landuse {
[zoom >= 15] {
text-name: "[name]";
text-size: 9;
text-fill: darken(@garages, 50%);
text-face-name: @book-fonts;
text-halo-radius: 1;
text-wrap-width: 10;
}
}

[landuse = 'field']::landuse {
[zoom >= 15] {
text-name: "[name]";
text-size: 9;
text-fill: darken(@field, 50%);
text-face-name: @book-fonts;
text-halo-radius: 1;
text-wrap-width: 10;
}
}

[landuse = 'meadow']::landuse,
[landuse = 'grass']::landuse {
[zoom >= 15] {
text-name: "[name]";
text-size: 9;
text-fill: darken(@grass, 65%);
text-face-name: @book-fonts;
text-halo-radius: 1;
text-wrap-width: 10;
}
}

[landuse = 'allotments']::landuse {
[zoom >= 15] {
text-name: "[name]";
text-size: 9;
text-fill: darken(@allotments, 60%);
text-face-name: @book-fonts;
text-halo-radius: 1;
text-wrap-width: 10;
}
}

[landuse = 'forest']::landuse {
[zoom >= 15] {
text-name: "[name]";
text-size: 9;
text-fill: darken(@forest, 50%);
text-face-name: @book-fonts;
text-halo-radius: 1;
text-wrap-width: 10;
}
}

[landuse = 'farm']::landuse,
[landuse = 'farmland']::landuse,
[landuse = 'farmyard']::landuse {
[zoom >= 15] {
text-name: "[name]";
text-size: 9;
text-fill: darken(@farm, 70%);
text-face-name: @book-fonts;
text-halo-radius: 1;
text-wrap-width: 10;
}
}

[landuse = 'retail']::landuse {
[zoom >= 15] {
text-name: "[name]";
text-size: 9;
text-fill: darken(@retail, 60%);
text-face-name: @book-fonts;
text-halo-radius: 1;
text-wrap-width: 10;
}
}

[landuse = 'industrial']::landuse,
[landuse = 'railway']::landuse {
[zoom >= 15] {
text-name: "[name]";
text-size: 9;
text-fill: darken(@industrial, 60%);
text-face-name: @book-fonts;
text-halo-radius: 1;
text-wrap-width: 10;
}
}

[landuse = 'commercial']::landuse {
[zoom >= 15] {
text-name: "[name]";
text-size: 9;
text-fill: darken(@commercial, 60%);
text-face-name: @book-fonts;
text-halo-radius: 1;
text-wrap-width: 10;
}
}

[landuse = 'brownfield']::landuse,
[landuse = 'landfill']::landuse,
[landuse = 'greenfield']::landuse,
[landuse = 'construction']::landuse {
[zoom >= 15] {
text-name: "[name]";
text-size: 9;
text-fill: darken(@construction, 50%);
text-face-name: @book-fonts;
text-halo-radius: 1;
text-wrap-width: 10;
}
}
Expand Down Expand Up @@ -731,7 +936,7 @@
[leisure = 'marina'][zoom >= 15]::leisure {
text-name: "[name]";
text-size: 8;
text-fill: #576ddf;
text-fill: @marina-text;
text-face-name: @book-fonts;
text-halo-radius: 1;
text-wrap-width: 30;
Expand Down Expand Up @@ -901,13 +1106,25 @@
[military = 'danger_area'][zoom >= 12]::military {
text-name: "[name]";
text-size: 9;
text-fill: pink;
text-fill: @military-text;
text-face-name: @bold-fonts;
text-halo-radius: 1;
text-wrap-width: 10;
text-placement: interior;
}

[landuse = 'military']::landuse {
[zoom >= 15] {
text-name: "[name]";
text-size: 9;
text-fill: @military-text;
text-face-name: @book-fonts;
text-halo-radius: 1;
text-wrap-width: 10;
text-placement: interior;
}
}

[aeroway = 'gate'][zoom >= 17]::aeroway {
text-name: "[ref]";
text-size: 10;
Expand Down
17 changes: 0 additions & 17 deletions landcover.mss
Expand Up @@ -5,7 +5,6 @@
@golf_course: #b5e3b5;
@natural: #c6e4b4; // also grassland
@park: #b6fdb6; // also recreation_ground
@park-text: #2c4b2c;
@wood: #aed1a0;
@vineyard: #abdf96;

Expand Down Expand Up @@ -386,22 +385,6 @@
}
}

#park-text {
[way_area >= 150000][zoom >= 14],
[way_area >= 80000][zoom >= 15],
[way_area >= 20000][zoom >= 16],
[zoom >= 17] {
text-name: "[name]";
text-size: 11;
text-fill: @park-text;
text-face-name: @book-fonts;
text-halo-radius: 1;
text-halo-fill: rgba(255,255,255,0.6);
text-wrap-width: 30;
text-placement: interior;
}
}

#cliffs {
[natural = 'cliff'][zoom >= 13] {
line-pattern-file: url('symbols/cliff.png');
Expand Down
27 changes: 2 additions & 25 deletions project.mml
Expand Up @@ -1503,7 +1503,7 @@
],
"Datasource": {
"type": "postgis",
"table": " (select way,amenity,shop,access,leisure,landuse,man_made,\"natural\",place,tourism,ele,name,ref,military,aeroway,waterway,historic,'yes'::text as point\n from planet_osm_point\n where amenity is not null\n or shop in ('supermarket','bakery','clothes','fashion','convenience','doityourself','hairdresser','department_store','butcher','car','car_repair','bicycle','florist')\n or leisure is not null\n or landuse is not null\n or tourism is not null\n or \"natural\" is not null\n or man_made in ('lighthouse','windmill')\n or place='island'\n or military='danger_area'\n or aeroway='gate'\n or waterway='lock'\n or historic in ('memorial','archaeological_site')\n ) as text",
"table": " (select way,amenity,shop,access,leisure,landuse,man_made,\"natural\",place,tourism,ele,name,ref,military,aeroway,waterway,historic,NULL as way_area\n from planet_osm_point\n where amenity is not null\n or shop in ('supermarket','bakery','clothes','fashion','convenience','doityourself','hairdresser','department_store','butcher','car','car_repair','bicycle','florist')\n or leisure is not null\n or landuse is not null\n or tourism is not null\n or \"natural\" is not null\n or man_made in ('lighthouse','windmill')\n or place='island'\n or military='danger_area'\n or aeroway='gate'\n or waterway='lock'\n or historic in ('memorial','archaeological_site')\n ) as text",
"extent": "-20037508,-19929239,20037508,19929239",
"key_field": "",
"geometry_field": "way",
Expand All @@ -1526,7 +1526,7 @@
],
"Datasource": {
"type": "postgis",
"table": "(select way,aeroway,shop,access,amenity,leisure,landuse,man_made,\"natural\",place,tourism,NULL as ele,name,ref,military,waterway,historic,'no'::text as point\n from planet_osm_polygon\n where amenity is not null\n or shop in ('supermarket','bakery','clothes','fashion','convenience','doityourself','hairdresser','department_store', 'butcher','car','car_repair','bicycle')\n or leisure is not null\n or landuse is not null\n or tourism is not null\n or \"natural\" is not null\n or man_made in ('lighthouse','windmill')\n or place='island'\n or military='danger_area'\n or historic in ('memorial','archaeological_site')\n ) as text_poly",
"table": "(select way,aeroway,shop,access,amenity,leisure,landuse,man_made,\"natural\",place,tourism,NULL as ele,name,ref,military,waterway,historic,way_area\n from planet_osm_polygon\n where amenity is not null\n or shop in ('supermarket','bakery','clothes','fashion','convenience','doityourself','hairdresser','department_store', 'butcher','car','car_repair','bicycle')\n or leisure is not null\n or landuse is not null\n or tourism is not null\n or \"natural\" is not null\n or man_made in ('lighthouse','windmill')\n or place='island'\n or military='danger_area'\n or historic in ('memorial','archaeological_site')\n ) as text_poly",
"extent": "-20037508,-19929239,20037508,19929239",
"key_field": "",
"geometry_field": "way",
Expand All @@ -1539,29 +1539,6 @@
"advanced": {},
"name": "text-poly"
},
{
"geometry": "polygon",
"extent": [
-179.99999692067183,
-84.96651228427099,
179.99999692067183,
84.96651228427098
],
"Datasource": {
"type": "postgis",
"table": "(select way,way_area,name\n from planet_osm_polygon\n where name is not null\n and leisure in ('playground', 'park', 'recreation_ground', 'common', 'garden', 'golf_course')\n order by way_area desc\n ) as park_text",
"extent": "-20037508,-19929239,20037508,19929239",
"key_field": "",
"geometry_field": "way",
"dbname": "gis"
},
"id": "park-text",
"class": "",
"srs-name": "900913",
"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",
"advanced": {},
"name": "park-text"
},
{
"geometry": "polygon",
"extent": [
Expand Down

0 comments on commit 60ea62a

Please sign in to comment.