Skip to content

Commit

Permalink
Merge branch 'math1985-buildings_rewrite_new'
Browse files Browse the repository at this point in the history
  • Loading branch information
gravitystorm committed Dec 22, 2014
2 parents 69123aa + d74501d commit b4aff69
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 80 deletions.
82 changes: 35 additions & 47 deletions buildings.mss
Original file line number Diff line number Diff line change
@@ -1,58 +1,46 @@
@building: #bca9a9;
@station: #d4aaaa;
@supermarket: pink;
@placeOfWorship: #777;
@terminal: #cc99ff;
@building-fill: #d6d1c8;
@building-line: darken(@building-fill, 10%);
@building-low-zoom: darken(@building-fill, 4%);

#buildings-lz {
[zoom >= 10] {
[railway = 'station']::railway,
[building = 'station'] {
polygon-fill: @station;
polygon-clip: false;
}
@building-major-fill: darken(@building-fill, 20%);
@building-major-line: darken(@building-major-fill, 25%);

[building = 'supermarket'] {
polygon-fill: @supermarket;
polygon-opacity: 0.5;
polygon-clip: false;
}
@building-aeroway-fill: #cc99ff;
@building-aeroway-line: darken(@building-aeroway-fill,15%);

[amenity = 'place_of_worship']::amenity {
polygon-opacity: 0.5;
polygon-fill: @placeOfWorship;
polygon-clip: false;
[zoom >= 15] {
polygon-opacity: 0.9;
polygon-fill: lighten(@placeOfWorship, 20%);
line-width: 0.3;
line-color: darken(@placeOfWorship, 40%);
}
}
}
}

#buildings {
[building = 'INT-light'][zoom >= 12] {
polygon-fill: @building;
polygon-opacity: 0.7;
polygon-clip: false;
}
[building != 'INT-light'][building != ''][zoom >= 12] {
polygon-fill: @building;
polygon-opacity: 0.9;
[zoom >= 12] {
polygon-fill: @building-low-zoom;
polygon-clip: false;
[zoom >= 16] {
line-color: saturate(darken(@building, 50%), 10%);
line-width: 0.2;
[zoom >= 15] {
line-color: @building-line;
polygon-fill: @building-fill;
line-width: .75;
line-clip: false;
}
}
[aeroway = 'terminal'][zoom >= 12]::aeroway {
polygon-fill: @terminal;
polygon-clip: false;
[zoom >= 14] {
line-color: saturate(darken(@terminal, 50%), 20%);
line-width: 0.2;
}

#buildings-major {
[zoom >= 12] {
[aeroway = 'terminal'] {
polygon-fill: @building-aeroway-fill;
polygon-clip: false;
[zoom >= 15] {
line-width: .75;
line-clip: false;
line-color: @building-aeroway-line;
}
}
[amenity = 'place_of_worship'] {
polygon-fill: @building-major-fill;
polygon-clip: false;
[zoom >= 15] {
line-width: .75;
line-clip: false;
line-color: @building-major-line;
}
}
}
}
17 changes: 17 additions & 0 deletions landcover.mss
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,14 @@
@garages: #dfddce;
@heath: #d6d99f;
@parking: #f7efb7;
@place_of_worship: #cdccc9;
@place_of_worship_outline: #111;
@playground: #ccfff1;
@power: #bbb;
@rest_area: #efc8c8; // also services
@sand: #ffdf88;
@school: #f0f0d8; // also university, college, hospital, kindergarten
@station: #d4aaaa;
@scrub: #b5e3b5;
@orchard: #9ed88f;
@theme_park: #734a08;
Expand Down Expand Up @@ -147,6 +150,16 @@
}
}

[feature = 'amenity_place_of_worship'] {
polygon-fill: @place_of_worship;
polygon-clip: false;
[zoom >= 15] {
line-color: @place_of_worship_outline;
line-width: 0.3;
line-clip: false;
}
}

[feature = 'landuse_residential'][zoom >= 10] {
polygon-fill: @residential;
[zoom >= 16] {
Expand Down Expand Up @@ -485,6 +498,10 @@
}
}

[feature = 'railway_station'][zoom >= 10] {
polygon-fill: @station;
}

[feature = 'leisure_sports_centre'],
[feature = 'leisure_stadium'] {
[zoom >= 10] {
Expand Down
14 changes: 7 additions & 7 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,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, name, religion, way_pixels,\n COALESCE(aeroway, amenity, landuse, leisure, military, \"natural\", power, tourism, highway) AS feature\n FROM (SELECT\n way, COALESCE(name, '') AS 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', 'residential', 'garages', 'field', 'meadow', 'grass', 'allotments', 'forest', 'farmyard', 'farm', 'farmland', 'recreation_ground', 'conservation', 'village_green', 'retail', 'industrial', 'railway', 'commercial', 'brownfield', 'landfill', 'construction') THEN landuse ELSE NULL END)) AS landuse,\n ('leisure_' || (CASE WHEN leisure IN ('swimming_pool', 'playground', 'park', 'recreation_ground', 'common', 'garden', 'golf_course', 'picnic_table', 'sports_centre', 'stadium', 'pitch', 'track') 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 ('beach', 'desert', 'heath', 'mud', 'grassland', 'wood', 'sand', 'scrub') THEN \"natural\" ELSE NULL END)) AS \"natural\",\n ('power_' || (CASE WHEN power IN ('station', 'sub_station', 'substation', '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,\n CASE WHEN religion IN ('christian', 'jewish') THEN religion ELSE 'INT-generic'::text END AS religion,\n way_area/(!pixel_width!*!pixel_height!) AS way_pixels\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 ('beach', 'desert', 'heath', 'mud', 'grassland', 'wood', 'sand', 'scrub')\n OR power IN ('station', 'sub_station', 'substation', 'generator')\n OR tourism IN ('attraction', 'camp_site', 'caravan_site', 'picnic_site', 'zoo')\n OR highway IN ('services', 'rest_area'))\n AND way_area/(!pixel_width!*!pixel_height!) > 0.01\n ORDER BY z_order, way_area DESC\n ) AS landcover\n) AS features",
"table": "(SELECT\n way, name, religion, way_pixels,\n COALESCE(aeroway, amenity, landuse, leisure, military, \"natural\", power, tourism, highway, railway) AS feature \n FROM (SELECT \n way, COALESCE(name, '') AS 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', 'residential', 'garages', 'field', 'meadow', 'grass', 'allotments', 'forest', 'farmyard', 'farm', 'farmland', 'recreation_ground', 'conservation', 'village_green', 'retail', 'industrial', 'railway', 'commercial', 'brownfield', 'landfill', 'construction') THEN landuse ELSE NULL END)) AS landuse,\n ('leisure_' || (CASE WHEN leisure IN ('swimming_pool', 'playground', 'park', 'recreation_ground', 'common', 'garden', 'golf_course', 'picnic_table', 'sports_centre', 'stadium', 'pitch', 'track') 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 ('beach', 'desert', 'heath', 'mud', 'grassland', 'wood', 'sand', 'scrub') THEN \"natural\" ELSE NULL END)) AS \"natural\",\n ('power_' || (CASE WHEN power IN ('station', 'sub_station', 'substation', '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,\n ('railway_' || (CASE WHEN railway = 'station' THEN railway ELSE NULL END)) AS railway,\n CASE WHEN religion IN ('christian', 'jewish') THEN religion ELSE 'INT-generic'::text END AS religion,\n way_area/(!pixel_width!*!pixel_height!) AS way_pixels\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 ('beach', 'desert', 'heath', 'mud', 'grassland', 'wood', 'sand', 'scrub')\n OR power IN ('station', 'sub_station', 'substation', 'generator')\n OR tourism IN ('attraction', 'camp_site', 'caravan_site', 'picnic_site', 'zoo')\n OR highway IN ('services', 'rest_area')\n OR railway = 'station')\n AND way_area/(!pixel_width!*!pixel_height!) > 0.01\n ORDER BY z_order, way_area DESC\n ) AS landcover\n) AS features",
"geometry_field": "way",
"type": "postgis",
"key_field": "",
Expand Down Expand Up @@ -377,14 +377,14 @@
"advanced": {}
},
{
"name": "buildings-lz",
"name": "buildings",
"srs-name": "900913",
"geometry": "polygon",
"class": "",
"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, building, railway, amenity FROM planet_osm_polygon\n WHERE railway = 'station'\n OR building IN ('station', 'supermarket')\n OR amenity = 'place_of_worship'\n ORDER BY z_order, way_area DESC\n) AS buildings_lz",
"table": "(SELECT\n way, building\n FROM planet_osm_polygon\n WHERE (building IS NOT NULL)\n AND building != 'no'\n ORDER BY z_order, way_area DESC\n) AS buildings",
"geometry_field": "way",
"type": "postgis",
"key_field": "",
Expand All @@ -396,18 +396,18 @@
180,
85.05112877980659
],
"id": "buildings-lz",
"id": "buildings",
"advanced": {}
},
{
"name": "buildings",
"name": "buildings-major",
"srs-name": "900913",
"geometry": "polygon",
"class": "",
"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, aeroway,\n CASE\n WHEN building IN ('garage', 'roof', 'garages', 'service', 'shed', 'shelter', 'cabin', 'storage_tank', 'tank', 'support', 'glasshouse', 'greenhouse', 'mobile_home', 'kiosk', 'silo', 'canopy', 'tent') THEN 'INT-light'::text\n ELSE building\n END AS building\n FROM planet_osm_polygon\n WHERE (building IS NOT NULL\n AND building NOT IN ('no', 'station', 'supermarket', 'planned')\n AND (railway IS NULL OR railway != 'station')\n AND (amenity IS NULL OR amenity != 'place_of_worship'))\n OR aeroway = 'terminal'\n ORDER BY z_order, way_area DESC\n) AS buildings",
"table": "(SELECT way, building, amenity, aeroway\n FROM planet_osm_polygon\n WHERE (building IS NOT NULL)\n AND building != 'no'\n AND (aeroway = 'terminal' OR amenity = 'place_of_worship')\n ORDER BY z_order,way_area DESC)\nAS buildings_major",
"geometry_field": "way",
"type": "postgis",
"key_field": "",
Expand All @@ -419,7 +419,7 @@
180,
85.05112877980659
],
"id": "buildings",
"id": "buildings-major",
"advanced": {}
},
{
Expand Down
47 changes: 21 additions & 26 deletions project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ Layer:
table: |-
(SELECT
way, name, religion, way_pixels,
COALESCE(aeroway, amenity, landuse, leisure, military, "natural", power, tourism, highway) AS feature
FROM (SELECT
way, COALESCE(name, '') AS name,
COALESCE(aeroway, amenity, landuse, leisure, military, "natural", power, 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,
('amenity_' || (CASE WHEN amenity IN ('parking', 'university', 'college', 'school', 'hospital', 'kindergarten', 'grave_yard') THEN amenity ELSE NULL END)) AS amenity,
('landuse_' || (CASE WHEN landuse IN ('quarry', 'vineyard', 'orchard', 'cemetery', 'residential', 'garages', 'field', 'meadow', 'grass', 'allotments', 'forest', 'farmyard', 'farm', 'farmland', 'recreation_ground', 'conservation', 'village_green', 'retail', 'industrial', 'railway', 'commercial', 'brownfield', 'landfill', 'construction') THEN landuse ELSE NULL END)) AS landuse,
Expand All @@ -138,6 +138,7 @@ Layer:
('power_' || (CASE WHEN power IN ('station', 'sub_station', 'substation', 'generator') THEN power ELSE NULL END)) AS power,
('tourism_' || (CASE WHEN tourism IN ('attraction', 'camp_site', 'caravan_site', 'picnic_site', 'zoo') THEN tourism ELSE NULL END)) AS tourism,
('highway_' || (CASE WHEN highway IN ('services', 'rest_area') THEN highway ELSE NULL END)) AS highway,
('railway_' || (CASE WHEN railway = 'station' THEN railway ELSE NULL END)) AS railway,
CASE WHEN religion IN ('christian', 'jewish') THEN religion ELSE 'INT-generic'::text END AS religion,
way_area/(!pixel_width!*!pixel_height!) AS way_pixels
FROM planet_osm_polygon
Expand All @@ -149,7 +150,8 @@ Layer:
OR "natural" IN ('beach', 'desert', 'heath', 'mud', 'grassland', 'wood', 'sand', 'scrub')
OR power IN ('station', 'sub_station', 'substation', 'generator')
OR tourism IN ('attraction', 'camp_site', 'caravan_site', 'picnic_site', 'zoo')
OR highway IN ('services', 'rest_area'))
OR highway IN ('services', 'rest_area')
OR railway = 'station')
AND way_area/(!pixel_width!*!pixel_height!) > 0.01
ORDER BY z_order, way_area DESC
) AS landcover
Expand Down Expand Up @@ -319,44 +321,37 @@ Layer:
WHERE waterway = 'lock_gate'
) AS locks
advanced: {}
- id: "buildings-lz"
name: "buildings-lz"
- id: "buildings"
name: "buildings"
class: ""
geometry: "polygon"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way, building, railway, amenity FROM planet_osm_polygon
WHERE railway = 'station'
OR building IN ('station', 'supermarket')
OR amenity = 'place_of_worship'
way, building
FROM planet_osm_polygon
WHERE (building IS NOT NULL)
AND building != 'no'
ORDER BY z_order, way_area DESC
) AS buildings_lz
) AS buildings
advanced: {}
- id: "buildings"
name: "buildings"
- id: "buildings-major"
name: "buildings-major"
class: ""
geometry: "polygon"
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way, aeroway,
CASE
WHEN building IN ('garage', 'roof', 'garages', 'service', 'shed', 'shelter', 'cabin', 'storage_tank', 'tank', 'support', 'glasshouse', 'greenhouse', 'mobile_home', 'kiosk', 'silo', 'canopy', 'tent') THEN 'INT-light'::text
ELSE building
END AS building
(SELECT way, building, amenity, aeroway
FROM planet_osm_polygon
WHERE (building IS NOT NULL
AND building NOT IN ('no', 'station', 'supermarket', 'planned')
AND (railway IS NULL OR railway != 'station')
AND (amenity IS NULL OR amenity != 'place_of_worship'))
OR aeroway = 'terminal'
ORDER BY z_order, way_area DESC
) AS buildings
WHERE (building IS NOT NULL)
AND building != 'no'
AND (aeroway = 'terminal' OR amenity = 'place_of_worship')
ORDER BY z_order,way_area DESC)
AS buildings_major
advanced: {}
- id: "tunnels"
name: "tunnels"
Expand Down

0 comments on commit b4aff69

Please sign in to comment.