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

Update leisure=golf_course color and render golf=* features (gravitystorm#661) #4381

Merged
merged 10 commits into from
Sep 11, 2021
4 changes: 2 additions & 2 deletions indexes.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
CREATE INDEX planet_osm_line_ferry
ON planet_osm_line USING GIST (way)
WHERE route = 'ferry' AND osm_id > 0;
CREATE INDEX planet_osm_line_name
CREATE INDEX planet_osm_line_label
ON planet_osm_line USING GIST (way)
WHERE name IS NOT NULL;
WHERE name IS NOT NULL OR ref IS NOT NULL;
CREATE INDEX planet_osm_line_river
ON planet_osm_line USING GIST (way)
WHERE waterway = 'river';
Expand Down
4 changes: 2 additions & 2 deletions indexes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ point:
place:
where: place IS NOT NULL AND name IS NOT NULL
line:
name:
where: name IS NOT NULL
label:
where: name IS NOT NULL OR ref IS NOT NULL
ferry:
where: route = 'ferry' AND osm_id > 0
river:
Expand Down
28 changes: 23 additions & 5 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Stylesheet:
- style/aerialways.mss
- style/admin.mss
- style/addressing.mss
- style/golf.mss
Layer:
- id: landcover-low-zoom
geometry: polygon
Expand Down Expand Up @@ -87,10 +88,11 @@ Layer:
table: |-
(SELECT
way, name, religion, way_pixels, is_building,
COALESCE(aeroway, amenity, wetland, power, landuse, leisure, man_made, "natural", shop, tourism, highway, railway) AS feature
COALESCE(aeroway, golf, amenity, wetland, power, landuse, leisure, man_made, "natural", shop, tourism, highway, railway) AS feature
FROM (SELECT
way, COALESCE(name, '') AS name,
('aeroway_' || (CASE WHEN aeroway IN ('apron', 'aerodrome') THEN aeroway END)) AS aeroway,
('golf_' || (CASE WHEN (tags->'golf') IN ('rough', 'fairway', 'driving_range', 'water_hazard', 'green', 'bunker', 'tee') THEN tags->'golf' ELSE NULL END)) AS golf,
('amenity_' || (CASE WHEN amenity IN ('bicycle_parking', 'motorcycle_parking', 'university', 'college', 'school', 'taxi',
'hospital', 'kindergarten', 'grave_yard', 'prison', 'place_of_worship', 'clinic', 'ferry_terminal',
'marketplace', 'community_centre', 'social_facility', 'arts_centre', 'parking_space', 'bus_station',
Expand Down Expand Up @@ -119,6 +121,7 @@ Layer:
WHERE (landuse IS NOT NULL
OR leisure IS NOT NULL
OR aeroway IN ('apron', 'aerodrome')
OR (tags->'golf') IS NOT NULL
OR amenity IN ('parking', 'bicycle_parking', 'motorcycle_parking', 'taxi', 'university', 'college', 'school', 'hospital', 'kindergarten',
'grave_yard', 'place_of_worship', 'prison', 'clinic', 'ferry_terminal', 'marketplace', 'community_centre', 'social_facility',
'arts_centre', 'parking_space', 'bus_station', 'fire_station', 'police')
Expand Down Expand Up @@ -1044,6 +1047,19 @@ Layer:
properties:
cache-features: true
minzoom: 11
- id: golf-line
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way, tags->'golf' AS golf, ref, name
jgruca marked this conversation as resolved.
Show resolved Hide resolved
FROM planet_osm_line
WHERE tags @> 'golf=>hole'
) AS golf_line
properties:
minzoom: 16
- id: necountries
geometry: linestring
<<: *extents
Expand Down Expand Up @@ -1536,7 +1552,8 @@ Layer:
AND way_area IS NULL
THEN amenity END,
'tourism_' || CASE WHEN tourism IN ('viewpoint', 'attraction') THEN tourism END,
'place_' || CASE WHEN place IN ('locality') AND way_area IS NULL THEN place END
'place_' || CASE WHEN place IN ('locality') AND way_area IS NULL THEN place END,
'golf_' || CASE WHEN tags->'golf' IN ('hole', 'pin') THEN tags->'golf' END
) AS feature,
access,
CASE
Expand Down Expand Up @@ -2007,15 +2024,15 @@ Layer:
(SELECT
way,
NULL as way_pixels,
COALESCE('aerialway_' || aerialway, 'attraction_' || CASE WHEN tags @> 'attraction=>water_slide' THEN 'water_slide' END, 'leisure_' || leisure, 'man_made_' || man_made, 'waterway_' || waterway, 'natural_' || "natural") AS feature,
COALESCE('aerialway_' || aerialway, 'attraction_' || CASE WHEN tags @> 'attraction=>water_slide' THEN 'water_slide' END, 'leisure_' || leisure, 'man_made_' || man_made, 'waterway_' || waterway, 'natural_' || "natural", CASE WHEN tags @> 'golf=>hole' THEN 'golf_hole' END) AS feature,
jgruca marked this conversation as resolved.
Show resolved Hide resolved
access,
name,
tags->'operator' as operator,
ref,
NULL AS way_area,
CASE WHEN building = 'no' OR building IS NULL THEN 'no' ELSE 'yes' END AS is_building
FROM planet_osm_line
WHERE (man_made IN ('pier', 'breakwater', 'groyne', 'embankment')
WHERE ((man_made IN ('pier', 'breakwater', 'groyne', 'embankment')
OR (man_made = 'pipeline'
AND tags-> 'location' IN ('overground', 'overhead', 'surface', 'outdoor')
OR bridge IN ('yes', 'aqueduct', 'cantilever', 'covered', 'trestle', 'viaduct'))
Expand All @@ -2024,7 +2041,8 @@ Layer:
OR leisure IN ('slipway', 'track')
OR waterway IN ('dam', 'weir')
OR "natural" IN ('arete', 'cliff', 'ridge'))
AND name IS NOT NULL
AND name IS NOT NULL)
OR (tags @> 'golf=>hole' AND ref IS NOT NULL)
) AS text_line
properties:
minzoom: 10
Expand Down
71 changes: 71 additions & 0 deletions style/golf.mss
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#landcover[zoom >= 12] {
::high-zoom[zoom >= 12] {
jgruca marked this conversation as resolved.
Show resolved Hide resolved
[feature = 'golf_tee'],
[feature = 'golf_fairway'],
[feature = 'golf_rough'],
[feature = 'golf_driving_range'] {
polygon-fill: @grass;
}
}
::high-zoom[zoom >= 13] {
[feature = 'golf_green'] {
polygon-fill: @pitch;
}
[feature = 'golf_bunker'] {
polygon-fill: @sand;
}
}
::high-zoom[zoom >= 15] {
[feature = 'golf_rough'] {
polygon-pattern-file: url('symbols/golf_rough.svg');
polygon-pattern-comp-op: soft-light;
}
}
}

#golf-line[zoom >= 16] {
[golf = 'hole'] {
line-color: @address-color;
line-width: 0.5;
}
}

#text-line[zoom >= 16] {
[feature = 'golf_hole'][ref != ''],
[feature = 'golf_hole'][name != ''] {
text-placement: line;
text-size: 11;
text-fill: @address-color;
text-face-name: @book-fonts;
text-halo-radius: @standard-halo-radius;
text-halo-fill: @standard-halo-fill;
text-name: "[ref]";

[name != ''] { text-name: "[name]"; }
pnorman marked this conversation as resolved.
Show resolved Hide resolved

[zoom >= 17] { text-size: 13; }
}
}

#amenity-points[zoom >= 16] {
[feature = 'golf_hole'],
[feature = 'golf_pin'] {
marker-file: url('symbols/golf_pin.svg');
marker-fill: @address-color;
marker-geometry-transform: translate(2, -5);
}
}

#text-point[zoom >= 17] {
[feature = 'golf_pin'][ref != ''] {
text-name: "[ref]";
text-size: @standard-font-size;
text-fill: @address-color;
text-face-name: @book-fonts;
text-halo-radius: @standard-halo-radius;
text-halo-fill: @standard-halo-fill;
text-horizontal-alignment: middle;
text-dx: 1;
text-dy: 6;
}
}
2 changes: 1 addition & 1 deletion style/landcover.mss
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
@pitch: #aae0cb; // Lch(85,22,168) also track
@track: @pitch;
@stadium: @leisure; // also sports_centre
@golf_course: #b5e3b5;
jgruca marked this conversation as resolved.
Show resolved Hide resolved
@golf_course: @campsite;

#landcover-low-zoom[zoom < 10],
#landcover[zoom >= 10] {
Expand Down
9 changes: 9 additions & 0 deletions symbols/golf_pin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions symbols/golf_rough.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.