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

Fix low priority layers #3874

Merged
merged 7 commits into from
Sep 20, 2019
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 65 additions & 88 deletions amenity-points.mss
Original file line number Diff line number Diff line change
Expand Up @@ -629,30 +629,6 @@
marker-clip: false;
}

[feature = 'amenity_parking'][way_pixels > 900][zoom >= 14],
[feature = 'amenity_bicycle_parking'][way_pixels > 900][zoom >= 14],
[feature = 'amenity_motorcycle_parking'][way_pixels > 900][zoom >= 14],
[feature = 'amenity_parking_entrance'][zoom >= 18] {
[feature = 'amenity_parking'] {
marker-file: url('symbols/amenity/parking.svg');
}
[feature = 'amenity_bicycle_parking'] {
marker-file: url('symbols/amenity/bicycle_parking.svg');
}
[feature = 'amenity_motorcycle_parking'] {
marker-file: url('symbols/amenity/motorcycle_parking.svg');
}
[feature = 'amenity_parking_entrance'] {
marker-file: url('symbols/amenity/parking_entrance.svg');
}
marker-placement: interior;
marker-clip: false;
marker-fill: @transportation-icon;
[access != ''][access != 'permissive'][access != 'yes'] {
marker-opacity: 0.33;
}
}

[feature = 'amenity_clinic'][zoom >= 17],
[feature = 'amenity_doctors'][zoom >= 17] {
marker-file: url('symbols/amenity/doctors.svg');
Expand Down Expand Up @@ -729,14 +705,6 @@
}
}

[feature = 'man_made_cross'][zoom >= 17],
[feature = 'historic_wayside_cross'][zoom >= 17] {
marker-file: url('symbols/man_made/cross.svg');
marker-fill: @religious-icon;
marker-placement: interior;
marker-clip: false;
}

[feature = 'man_made_storage_tank'][zoom >= 18],
[feature = 'man_made_silo'][zoom >= 18] {
marker-file: url('symbols/man_made/storage_tank.svg');
Expand All @@ -745,13 +713,6 @@
marker-clip: false;
}

[feature = 'historic_wayside_shrine'][zoom >= 17] {
marker-file: url('symbols/historic/shrine.svg');
marker-fill: @man-made-icon;
marker-placement: interior;
marker-clip: false;
}

[feature = 'amenity_police'][zoom >= 16] {
marker-file: url('symbols/amenity/police.svg');
marker-fill: @public-service;
Expand Down Expand Up @@ -1593,7 +1554,7 @@
}
}

.amenity-low-priority {
#amenity-low-priority {
[feature = 'man_made_cross'][zoom >= 16],
[feature = 'historic_wayside_cross'][zoom >= 16] {
marker-file: url('symbols/man_made/cross.svg');
Expand All @@ -1602,23 +1563,28 @@
marker-clip: false;
}

[feature = 'amenity_parking'][zoom >= 17],
[feature = 'amenity_bicycle_parking'][zoom >= 18],
[feature = 'amenity_motorcycle_parking'][zoom >= 18] {
[feature = 'amenity_parking'] {
marker-file: url('symbols/amenity/parking.svg');
}
[feature = 'amenity_bicycle_parking'] {
marker-file: url('symbols/amenity/bicycle_parking.svg');
}
[feature = 'amenity_motorcycle_parking'] {
marker-file: url('symbols/amenity/motorcycle_parking.svg');
}
[feature = 'historic_wayside_shrine'][zoom >= 17] {
marker-file: url('symbols/historic/shrine.svg');
marker-fill: @man-made-icon;
marker-placement: interior;
marker-clip: false;
marker-fill: @transportation-icon;
[access != ''][access != 'permissive'][access != 'yes'] {
marker-opacity: 0.33;
}

[feature = 'amenity_parking'],
[feature = 'amenity_bicycle_parking'],
[feature = 'amenity_motorcycle_parking'],
[feature = 'amenity_parking_entrance'] {
[zoom >= 14][way_pixels > 900],
[zoom >= 17][feature = 'amenity_parking'],
[zoom >= 18] {
[feature = 'amenity_parking'] { marker-file: url('symbols/amenity/parking.svg'); }
[feature = 'amenity_bicycle_parking'] { marker-file: url('symbols/amenity/bicycle_parking.svg'); }
[feature = 'amenity_motorcycle_parking'] { marker-file: url('symbols/amenity/motorcycle_parking.svg'); }
[feature = 'amenity_parking_entrance'] { marker-file: url('symbols/amenity/parking_entrance.svg'); }
marker-placement: interior;
marker-clip: false;
marker-fill: @transportation-icon;
[access != ''][access != 'permissive'][access != 'yes'] { marker-opacity: 0.33; }
}
}

Expand Down Expand Up @@ -1885,30 +1851,6 @@
text-placement: interior;
}

[feature = 'amenity_parking'][zoom >= 10][way_pixels > 900],
[feature = 'amenity_bicycle_parking'][zoom >= 10][way_pixels > 900],
[feature = 'amenity_motorcycle_parking'][zoom >= 10][way_pixels > 900],
[feature = 'amenity_parking_entrance'][zoom >= 18] {
text-name: "[name]";
text-size: @standard-font-size;
text-wrap-width: @standard-wrap-width;
text-line-spacing: @standard-line-spacing-size;
text-fill: @transportation-text;
text-dy: 9;
text-face-name: @standard-font;
text-halo-radius: @standard-halo-radius;
text-halo-fill: @standard-halo-fill;
text-placement: interior;
[access != ''][access != 'permissive'][access != 'yes'] {
text-opacity: 0.33;
text-halo-radius: 0;
}
[feature = 'amenity_bicycle_parking'],
[feature = 'amenity_motorcycle_parking'] {
text-dy: 12;
}
}

[feature = 'amenity_courthouse'][zoom >= 17],
[feature = 'amenity_townhall'][zoom >= 17],
[feature = 'amenity_police'][zoom >= 17],
Expand Down Expand Up @@ -2079,12 +2021,9 @@
}
}

[feature = 'man_made_cross'][zoom >= 17],
[feature = 'power_generator'][location != 'rooftop'][location != 'roof'][zoom >= 17],
[feature = 'power_generator'][location = null][zoom >= 17],
[feature = 'power_generator'][zoom >= 19],
[feature = 'historic_wayside_cross'][zoom >= 17],
[feature = 'historic_wayside_shrine'][zoom >= 17],
[feature = 'historic_city_gate'][zoom >= 17],
[feature = 'natural_cave_entrance'][zoom >= 15],
[feature = 'man_made_mast'][zoom >= 18],
Expand All @@ -2103,10 +2042,6 @@
text-wrap-width: @standard-wrap-width;
text-line-spacing: @standard-line-spacing-size;
text-fill: darken(@man-made-icon, 20%);
[feature = 'man_made_cross'],
[feature = 'historic_wayside_cross'] {
text-dy: 6;
}
[feature = 'power_generator'],
[feature = 'historic_city_gate'],
[feature = 'man_made_mast'],
Expand Down Expand Up @@ -2155,8 +2090,7 @@
text-placement: interior;
}

[feature = 'military_bunker'][zoom >= 17],
[feature = 'historic_wayside_shrine'][zoom >= 17] {
[feature = 'military_bunker'][zoom >= 17] {
text-name: "[name]";
text-size: @standard-font-size;
text-wrap-width: @standard-wrap-width;
Expand Down Expand Up @@ -3181,6 +3115,49 @@
}
}

#text-low-priority {
[feature = 'amenity_parking'],
[feature = 'amenity_bicycle_parking'],
[feature = 'amenity_motorcycle_parking'],
[feature = 'amenity_parking_entrance'] {
[zoom >= 10][way_pixels > 900],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this is not introduced by your change this is weird - for large parking labels seems to start at z10 while the symbol does not start before z14 - which does not make much sense.

[zoom >= 18] {
text-name: "[name]";
text-size: @standard-font-size;
text-wrap-width: @standard-wrap-width;
text-line-spacing: @standard-line-spacing-size;
text-fill: @transportation-text;
text-dy: 9;
text-face-name: @standard-font;
text-halo-radius: @standard-halo-radius;
text-halo-fill: @standard-halo-fill;
text-placement: interior;
[access != ''][access != 'permissive'][access != 'yes'] {
text-opacity: 0.33;
text-halo-radius: 0;
}
[feature = 'amenity_bicycle_parking'],
[feature = 'amenity_motorcycle_parking'] { text-dy: 12; }
}
}

[feature = 'man_made_cross'][zoom >= 17],
[feature = 'historic_wayside_cross'][zoom >= 17],
[feature = 'historic_wayside_shrine'][zoom >= 17] {
text-name: "[name]";
text-size: @standard-font-size;
text-wrap-width: @standard-wrap-width;
text-line-spacing: @standard-line-spacing-size;
text-fill: darken(@man-made-icon, 20%);
text-dy: 6;
[feature = 'historic_wayside_shrine'] { text-dy: 10; }
text-face-name: @standard-font;
text-halo-radius: @standard-halo-radius;
text-halo-fill: @standard-halo-fill;
text-placement: interior;
}
}

#amenity-line {
// Ford tagging on ways
[feature = 'highway_ford'][zoom >= 16] {
Expand Down
106 changes: 62 additions & 44 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -1415,23 +1415,17 @@ Layer:
'tourism_' || CASE WHEN tourism IN ('alpine_hut', 'apartment', 'artwork', 'camp_site', 'caravan_site', 'chalet', 'gallery', 'guest_house',
'hostel', 'hotel', 'motel', 'museum', 'picnic_site', 'theme_park', 'wilderness_hut',
'zoo') THEN tourism ELSE NULL END,
'amenity_' || CASE WHEN amenity IN ('arts_centre', 'atm', 'bank', 'bar', 'bbq', 'bicycle_parking', 'bicycle_rental',
'amenity_' || CASE WHEN amenity IN ('arts_centre', 'atm', 'bank', 'bar', 'bbq', 'bicycle_rental',
'bicycle_repair_station','biergarten', 'boat_rental', 'bureau_de_change', 'bus_station', 'cafe',
'car_rental', 'car_wash', 'casino', 'charging_station', 'childcare', 'cinema', 'clinic', 'college',
'community_centre', 'courthouse', 'dentist', 'doctors', 'drinking_water', 'driving_school', 'embassy',
'fast_food', 'ferry_terminal', 'fire_station', 'food_court', 'fountain', 'fuel', 'grave_yard',
'hospital', 'hunting_stand', 'ice_cream', 'internet_cafe', 'kindergarten', 'library', 'marketplace',
'motorcycle_parking', 'nightclub', 'nursing_home', 'pharmacy', 'place_of_worship', 'police', 'post_box',
'nightclub', 'nursing_home', 'pharmacy', 'place_of_worship', 'police', 'post_box',
'post_office', 'prison', 'pub', 'public_bath', 'public_bookcase', 'recycling', 'restaurant', 'school',
'shelter', 'shower', 'social_facility', 'taxi', 'telephone', 'theatre', 'toilets', 'townhall',
'university', 'vehicle_inspection', 'veterinary') THEN amenity ELSE NULL END,
'amenity_' || CASE WHEN amenity IN ('waste_disposal') AND way_area IS NOT NULL THEN amenity ELSE NULL END, -- Waste disposal points are rendered in the low priority layer
'amenity_' || CASE WHEN amenity IN ('parking_entrance')
AND tags->'parking' IN ('underground')
AND (access IS NULL OR access NOT IN ('private', 'no'))
AND way_area IS NULL -- Only parking points are rendered
THEN amenity ELSE NULL END,
'amenity_' || CASE WHEN amenity IN ('parking') AND (tags->'parking' NOT IN ('underground') OR (tags->'parking') IS NULL) THEN amenity ELSE NULL END,
'amenity_' || CASE WHEN amenity IN ('vending_machine') AND tags->'vending' IN ('excrement_bags', 'parking_tickets', 'public_transport_tickets') THEN amenity ELSE NULL END,
'advertising_' || CASE WHEN tags->'advertising' in ('column') THEN tags->'advertising' else NULL END,
'emergency_' || CASE WHEN tags->'emergency' IN ('phone') AND way_area IS NULL THEN tags->'emergency' ELSE NULL END,
Expand Down Expand Up @@ -1466,8 +1460,6 @@ Layer:
'office' || CASE WHEN tags->'office' IN ('no', 'vacant', 'closed', 'disused', 'empty') OR (tags->'office') IS NULL THEN NULL ELSE '' END,
'barrier_' || CASE WHEN barrier IN ('toll_booth') AND way_area IS NULL THEN barrier ELSE NULL END,
'waterway_' || CASE WHEN waterway IN ('dam', 'weir', 'dock') THEN waterway ELSE NULL END,
'man_made_' || CASE WHEN man_made IN ('cross') AND way_area IS NULL THEN man_made ELSE NULL END,
'historic_' || CASE WHEN historic IN ('wayside_cross', 'wayside_shrine') AND way_area IS NULL THEN historic ELSE NULL END,
'tourism_' || CASE WHEN tourism IN ('viewpoint', 'attraction') THEN tourism ELSE NULL END,
'place_' || CASE WHEN place IN ('locality') AND way_area IS NULL THEN place ELSE NULL END
) AS feature,
Expand Down Expand Up @@ -2191,57 +2183,83 @@ Layer:
properties:
minzoom: 13
- id: amenity-low-priority
class: amenity-low-priority
geometry: point
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
table: &amenity_low_priority_sql |-
(SELECT
way,
name,
COALESCE(
'highway_' || CASE WHEN highway IN ('mini_roundabout') THEN highway ELSE NULL END,
jeisenbe marked this conversation as resolved.
Show resolved Hide resolved
'railway_' || CASE WHEN railway IN ('level_crossing', 'crossing') THEN railway ELSE NULL END,
'amenity_' || CASE WHEN amenity IN ('bicycle_parking', 'motorcycle_parking', 'bench',
'waste_basket', 'waste_disposal') THEN amenity ELSE NULL END,
'highway_' || CASE WHEN highway IN ('mini_roundabout') AND way_area IS NULL THEN highway ELSE NULL END,
'railway_' || CASE WHEN railway IN ('level_crossing', 'crossing') AND way_area IS NULL THEN railway ELSE NULL END,
'amenity_' || CASE WHEN amenity IN ('bicycle_parking', 'motorcycle_parking') THEN amenity ELSE NULL END,
'amenity_' || CASE WHEN amenity IN ('parking') AND (tags->'parking' NOT IN ('underground') OR (tags->'parking') IS NULL) THEN amenity ELSE NULL END,
'historic_' || CASE WHEN historic IN ('wayside_cross', 'wayside_shrine') THEN historic ELSE NULL END,
'man_made_' || CASE WHEN man_made IN ('cross') THEN man_made ELSE NULL END,
'amenity_' || CASE WHEN amenity IN ('parking_entrance')
AND tags->'parking' IN ('underground')
AND (access IS NULL OR access NOT IN ('private', 'no'))
AND way_area IS NULL
THEN amenity ELSE NULL END,
'amenity_' || CASE WHEN amenity IN ('bench', 'waste_basket', 'waste_disposal') AND way_area IS NULL THEN amenity ELSE NULL END,
'historic_' || CASE WHEN historic IN ('wayside_cross', 'wayside_shrine') AND way_area IS NULL THEN historic ELSE NULL END,
'man_made_' || CASE WHEN man_made IN ('cross') AND way_area IS NULL THEN man_made ELSE NULL END,
'barrier_' || CASE WHEN barrier IN ('bollard', 'gate', 'lift_gate', 'swing_gate', 'block', 'log', 'cattle_grid', 'stile', 'motorcycle_barrier', 'cycle_barrier', 'full-height_turnstile', 'turnstile', 'kissing_gate') THEN barrier ELSE NULL END
) AS feature,
access,
way_area,
way_area/NULLIF(POW(!scale_denominator!*0.001*0.28,2),0) AS way_pixels,
CASE WHEN amenity IN ('waste_basket', 'waste_disposal') THEN 2 ELSE 1 END AS prio
FROM planet_osm_point p
WHERE highway IN ('mini_roundabout')
OR railway IN ('level_crossing', 'crossing')
OR amenity IN ('parking', 'bicycle_parking', 'motorcycle_parking', 'bench', 'waste_basket', 'waste_disposal')
OR historic IN ('wayside_cross', 'wayside_shrine')
OR man_made IN ('cross')
OR barrier IN ('bollard', 'gate', 'lift_gate', 'swing_gate', 'block', 'log', 'cattle_grid', 'stile', 'motorcycle_barrier', 'cycle_barrier', 'full-height_turnstile', 'turnstile', 'kissing_gate')
ORDER BY prio
FROM
(SELECT
ST_PointOnSurface(way) AS way,
name,
access,
amenity,
barrier,
highway,
historic,
man_made,
railway,
tags,
way_area
FROM planet_osm_polygon
WHERE way && !bbox!
UNION ALL
SELECT
way,
name,
access,
amenity,
barrier,
highway,
historic,
man_made,
railway,
tags,
NULL AS way_area
FROM planet_osm_point
WHERE way && !bbox!
) _
WHERE highway IN ('mini_roundabout')
OR railway IN ('level_crossing', 'crossing')
OR amenity IN ('parking', 'parking_entrance', 'bicycle_parking', 'motorcycle_parking', 'bench', 'waste_basket', 'waste_disposal')
OR historic IN ('wayside_cross', 'wayside_shrine')
OR man_made IN ('cross')
OR barrier IN ('bollard', 'gate', 'lift_gate', 'swing_gate', 'block', 'log', 'cattle_grid', 'stile', 'motorcycle_barrier', 'cycle_barrier', 'full-height_turnstile', 'turnstile', 'kissing_gate')
ORDER BY prio DESC NULLS LAST,
way_pixels DESC NULLS LAST
) AS amenity_low_priority
properties:
cache-features: true
minzoom: 14
- id: amenity-low-priority-poly
class: amenity-low-priority
geometry: polygon
- id: text-low-priority
geometry: point
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
COALESCE(
'amenity_' || CASE WHEN amenity IN ('bicycle_parking', 'motorcycle_parking') THEN amenity ELSE NULL END,
'amenity_' || CASE WHEN amenity IN ('parking') AND (tags->'parking' NOT IN ('underground') OR (tags->'parking') IS NULL) THEN amenity ELSE NULL END,
'barrier_' || CASE WHEN barrier IN ('bollard', 'gate', 'lift_gate', 'swing_gate', 'block', 'log', 'cattle_grid', 'stile', 'motorcycle_barrier', 'cycle_barrier', 'full-height_turnstile', 'turnstile', 'kissing_gate') THEN barrier ELSE NULL END
) AS feature,
access
FROM planet_osm_polygon p
WHERE amenity IN ('parking', 'bicycle_parking', 'motorcycle_parking')
OR barrier IN ('bollard', 'gate', 'lift_gate', 'swing_gate', 'block', 'log', 'cattle_grid', 'stile', 'motorcycle_barrier', 'cycle_barrier', 'full-height_turnstile', 'turnstile', 'kissing_gate')
) AS amenity_low_priority_poly
# Include values that are rendered as icon without label to prevent mismatch between icons and labels,
# see https://github.com/gravitystorm/openstreetmap-carto/pull/1349#issuecomment-77805678
table: *amenity_low_priority_sql
properties:
cache-features: true
minzoom: 14
minzoom: 10