Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix the landcover ordering problem. Closes #15.

For detailed thinking behind the over-complicated SQL query, see the
conversation at
#15
  • Loading branch information...
commit 34b154171bd67623c1adc545198078e9cc746563 1 parent a950ec3
@gravitystorm authored
Showing with 67 additions and 67 deletions.
  1. +66 −66 landcover.mss
  2. +1 −1  project.mml
View
132 landcover.mss
@@ -1,19 +1,19 @@
#landcover {
- [leisure = 'swimming_pool'][zoom >= 14]::leisure {
+ [feature = 'leisure_swimming_pool'][zoom >= 14] {
polygon-fill: @water-color;
line-color: blue;
line-width: 0.5;
}
- [leisure = 'playground'][zoom >= 13]::leisure {
+ [feature = 'leisure_playground'][zoom >= 13] {
polygon-fill: #ccfff1;
line-color: #666;
line-width: 0.3;
}
- [tourism = 'camp_site']::tourism,
- [tourism = 'caravan_site']::tourism,
- [tourism = 'picnic_site']::tourism {
+ [feature = 'tourism_camp_site'],
+ [feature = 'tourism_caravan_site'],
+ [feature = 'tourism_picnic_site'] {
[zoom >= 13] {
polygon-fill: #ccff99;
polygon-opacity: 0.5;
@@ -22,17 +22,17 @@
}
}
- [tourism = 'attraction'][zoom >= 10]::tourism {
+ [feature = 'tourism_attraction'][zoom >= 10] {
polygon-fill: #f2caea;
}
- [landuse = 'quarry'][zoom >= 11]::landuse {
+ [feature = 'landuse_quarry'][zoom >= 11] {
polygon-pattern-file: url('symbols/quarry2.png');
line-width: 0.5;
line-color: grey;
}
- [landuse = 'vineyard']::landuse {
+ [feature = 'landuse_vineyard'] {
[zoom >= 10][zoom < 13] {
polygon-fill: #abdf96;
}
@@ -41,13 +41,13 @@
}
}
- [landuse = 'orchard'][zoom >= 10]::landuse {
+ [feature = 'landuse_orchard'][zoom >= 10] {
polygon-pattern-file: url('symbols/orchard.png');
}
- [landuse = 'cemetery']::landuse,
- [landuse = 'grave_yard']::landuse,
- [amenity = 'grave_yard']::amenity {
+ [feature = 'landuse_cemetery'],
+ [feature = 'landuse_grave_yard'],
+ [feature = 'amenity_grave_yard'] {
[zoom >= 10][zoom < 14] {
polygon-fill: #aacbaf;
}
@@ -58,21 +58,21 @@
}
}
- [landuse = 'residential'][zoom >= 10]::landuse {
+ [feature = 'landuse_residential'][zoom >= 10] {
polygon-fill: #ddd;
}
- [landuse = 'garages'][zoom >= 12]::landuse {
+ [feature = 'landuse_garages'][zoom >= 12] {
polygon-fill: #996;
polygon-opacity: 0.2;
}
- [military = 'barracks'][zoom >= 10]::military {
+ [feature = 'military_barracks'][zoom >= 10] {
polygon-fill: #ff8f8f;
}
- [landuse = 'field']::landuse,
- [natural = 'field']::natural {
+ [feature = 'landuse_field'],
+ [feature = 'natural_field'] {
[zoom >= 10] {
polygon-fill: #666600;
polygon-opacity: 0.2;
@@ -84,7 +84,7 @@
}
}
- [military = 'danger_area']::military {
+ [feature = 'military_danger_area'] {
[zoom >= 9][zoom < 11] {
polygon-fill: pink;
polygon-opacity: 0.3;
@@ -94,38 +94,38 @@
}
}
- [landuse = 'meadow']::landuse,
- [landuse = 'grass']::landuse {
+ [feature = 'landuse_meadow'],
+ [feature = 'landuse_grass'] {
[zoom >= 10] {
polygon-fill: #cfeca8;
}
}
- [leisure = 'park']::leisure,
- [leisure = 'recreation_ground']::leisure {
+ [feature = 'leisure_park'],
+ [feature = 'leisure_recreation_ground'] {
[zoom >= 10] {
polygon-fill: #b6fdb6;
polygon-opacity: 0.6;
}
}
- [tourism = 'zoo'][zoom >= 10]::tourism {
+ [feature = 'tourism_zoo'][zoom >= 10] {
polygon-pattern-file: url('symbols/zoo.png');
}
- [leisure = 'common'][zoom >= 10]::leisure {
+ [feature = 'leisure_common'][zoom >= 10] {
polygon-fill: #cfeca8;
}
- [leisure = 'garden'][zoom >= 10]::leisure {
+ [feature = 'leisure_garden'][zoom >= 10] {
polygon-fill: #cfeca8;
}
- [leisure = 'golf_course'][zoom >= 10]::leisure {
+ [feature = 'leisure_golf_course'][zoom >= 10] {
polygon-fill: #b5e3b5;
}
- [landuse = 'allotments']::landuse {
+ [feature = 'landuse_allotments'] {
[zoom >= 10][zoom < 14] {
polygon-fill: #e5c7ab;
}
@@ -134,7 +134,7 @@
}
}
- [landuse = 'forest']::landuse {
+ [feature = 'landuse_forest'] {
[zoom >= 8][zoom < 14] {
polygon-fill: #8dc56c;
}
@@ -143,29 +143,29 @@
}
}
- [landuse = 'farmyard'][zoom >= 9]::landuse {
+ [feature = 'landuse_farmyard'][zoom >= 9] {
polygon-fill: #ddbf92;
}
- [landuse = 'farm']::landuse,
- [landuse = 'farmland']::landuse {
+ [feature = 'landuse_farm'],
+ [feature = 'landuse_farmland'] {
[zoom >= 9] {
polygon-fill: #ead8bd;
}
}
- [landuse = 'recreation_ground']::landuse,
- [landuse = 'conservation']::landuse {
+ [feature = 'landuse_recreation_ground'],
+ [feature = 'landuse_conservation'] {
[zoom >= 10] {
polygon-fill: #cfeca8;
}
}
- [landuse = 'village_green'][zoom >= 11]::landuse {
+ [feature = 'landuse_village_green'][zoom >= 11] {
polygon-fill: #cfeca8;
}
- [landuse = 'retail'][zoom >= 10]::landuse {
+ [feature = 'landuse_retail'][zoom >= 10] {
polygon-fill: #f1dada;
[zoom >= 15] {
line-width: 0.3;
@@ -173,15 +173,15 @@
}
}
- [landuse = 'industrial']::landuse,
- [landuse = 'railway']::landuse {
+ [feature = 'landuse_industrial'],
+ [feature = 'landuse_railway'] {
[zoom >= 10] {
polygon-fill: #dfd1d6;
}
}
- [power = 'station']::power,
- [power = 'generator']::power {
+ [feature = 'power_station'],
+ [feature = 'power_generator'] {
[zoom >= 10] {
polygon-fill: #bbb;
[zoom >= 12] {
@@ -191,50 +191,50 @@
}
}
- [power = 'sub_station'][zoom >= 13]::power {
+ [feature = 'power_sub_station'][zoom >= 13] {
polygon-fill: #bbb;
line-width: 0.4;
line-color: #555;
}
- [landuse = 'commercial'][zoom >= 10]::landuse {
+ [feature = 'landuse_commercial'][zoom >= 10] {
polygon-fill: #efc8c8;
}
- [landuse = 'brownfield'],
- [landuse = 'landfill'],
- [landuse = 'greenfield'],
- [landuse = 'construction'] {
- [zoom >= 10]::landuse {
+ [feature = 'landuse_brownfield'],
+ [feature = 'landuse_landfill'],
+ [feature = 'landuse_greenfield'],
+ [feature = 'landuse_construction'] {
+ [zoom >= 10] {
polygon-fill: #9d9d6c;
polygon-opacity: 0.7;
}
}
- [natural = 'wood']::natural,
- [landuse = 'wood']::landuse {
+ [feature = 'natural_wood'],
+ [feature = 'landuse_wood'] {
[zoom >= 8] {
polygon-fill: #aed1a0;
}
}
- [natural = 'desert'][zoom >= 8]::natural {
+ [feature = 'natural_desert'][zoom >= 8] {
polygon-fill: #e3b57a;
}
- [natural = 'sand'][zoom >= 10]::natural {
+ [feature = 'natural_sand'][zoom >= 10] {
polygon-fill: #ffdf88;
}
- [natural = 'heath'][zoom >= 10]::natural {
+ [feature = 'natural_heath'][zoom >= 10] {
polygon-fill: #d6d99f;
}
- [natural = 'grassland'][zoom >= 10]::natural {
+ [feature = 'natural_grassland'][zoom >= 10] {
polygon-fill: #c6e4b4;
}
- [natural = 'scrub']::natural {
+ [feature = 'natural_scrub'] {
[zoom >= 10][zoom < 14] {
polygon-fill: #b5e3b5;
}
@@ -243,12 +243,12 @@
}
}
- [amenity = 'university'],
- [amenity = 'college'],
- [amenity = 'school'],
- [amenity = 'hospital'],
- [amenity = 'kindergarten'] {
- [zoom >= 10]::amenity {
+ [feature = 'amenity_university'],
+ [feature = 'amenity_college'],
+ [feature = 'amenity_school'],
+ [feature = 'amenity_hospital'],
+ [feature = 'amenity_kindergarten'] {
+ [zoom >= 10] {
polygon-fill: #f0f0d8;
[zoom >= 12] {
line-width: 0.3;
@@ -257,7 +257,7 @@
}
}
- [amenity = 'parking'][zoom >= 10]::amenity {
+ [feature = 'amenity_parking'][zoom >= 10] {
polygon-fill: #f7efb7;
[zoom >= 15] {
line-width: 0.3;
@@ -265,24 +265,24 @@
}
}
- [aeroway = 'apron'][zoom >= 12]::aeroway {
+ [feature = 'aeroway_apron'][zoom >= 12] {
polygon-fill: #e9d1ff;
}
- [aeroway = 'aerodrome'][zoom >= 12]::aeroway {
+ [feature = 'aeroway_aerodrome'][zoom >= 12] {
polygon-fill: #ccc;
polygon-opacity: 0.2;
line-width: 0.2;
line-color: #555;
}
- [natural = 'beach'][zoom >= 13]::natural {
+ [feature = 'natural_beach'][zoom >= 13] {
polygon-pattern-file: url('symbols/beach.png');
}
- [highway = 'services'],
- [highway = 'rest_area'] {
- [zoom >= 14]::highway {
+ [feature = 'highway_services'],
+ [feature = 'highway_rest_area'] {
+ [zoom >= 14] {
polygon-fill: #efc8c8;
}
}
View
2  project.mml
@@ -134,7 +134,7 @@
],
"Datasource": {
"type": "postgis",
- "table": "(select way,aeroway,amenity,landuse,leisure,man_made,military,\"natural\",power,tourism,name,highway,\n case when religion in ('christian','jewish') then religion else 'INT-generic'::text end as religion\n from planet_osm_polygon\n where landuse is not null\n or leisure is not null\n or aeroway in ('apron','aerodrome')\n or amenity in ('parking','university','college','school','hospital','kindergarten','grave_yard')\n or military in ('barracks','danger_area')\n or \"natural\" in ('field','beach','desert','heath','mud','grassland','wood','sand','scrub')\n or power in ('station','sub_station','generator')\n or tourism in ('attraction','camp_site','caravan_site','picnic_site','zoo')\n or highway in ('services','rest_area')\n order by z_order,way_area desc\n ) as leisure",
+ "table": "(select way,name,religion,\ncoalesce (aeroway, amenity, landuse, leisure, military, \"natural\", power, tourism, highway) as feature from (\nselect way, name,\n('aeroway_' || (case when aeroway in ('apron', 'aerodrome') then aeroway else null end)) as aeroway,\n('amenity_' || (case when amenity in ('parking', 'university', 'college', 'school', 'hospital', 'kindergarten', 'grave_yard') then amenity else null end)) as amenity,\n('landuse_' || (case when landuse in ('quarry', 'vineyard', 'orchard', 'cemetery', 'grave_yard', 'residential', 'garages', 'field', 'meadow', 'grass', 'allotments', 'forest', 'farmyard', 'farm', 'farmyard', 'recreation_ground', 'conservation', 'village_green', 'retail', 'industrial', 'railway', 'commercial', 'brownfield', 'landfill', 'greenfield', 'construction', 'wood') then landuse else null end)) as landuse,\n('leisure_' || (case when leisure in ('swimming_pool', 'playground', 'park', 'recreation_ground', 'common', 'garden', 'golf_course') then leisure else null end)) as leisure,\n('military_' || (case when military in ('barracks', 'danger_area') then military else null end)) as military,\n('natural_' || (case when \"natural\" in ('field','beach','desert','heath','mud','grassland','wood','sand','scrub') then \"natural\" else null end)) as \"natural\",\n('power_' || (case when power in ('station','sub_station','generator') then power else null end)) as power,\n('tourism_' || (case when tourism in ('attraction', 'camp_site', 'caravan_site', 'picnic_site', 'zoo') then tourism else null end)) as tourism,\n('highway_' || (case when highway in ('services', 'rest_area') then highway else null end)) as highway,\ncase when religion in ('christian','jewish') then religion else 'INT-generic'::text end as religion\n from planet_osm_polygon\n where landuse is not null\n or leisure is not null\n or aeroway in ('apron','aerodrome')\n or amenity in ('parking','university','college','school','hospital','kindergarten','grave_yard')\n or military in ('barracks','danger_area')\n or \"natural\" in ('field','beach','desert','heath','mud','grassland','wood','sand','scrub')\n or power in ('station','sub_station','generator')\n or tourism in ('attraction','camp_site','caravan_site','picnic_site','zoo')\n or highway in ('services','rest_area')\n order by z_order,way_area desc\n ) as landcover\n) as features",
"extent": "-20037508,-19929239,20037508,19929239",
"key_field": "",
"geometry_field": "",
Please sign in to comment.
Something went wrong with that request. Please try again.