From 64a27bd64f3714cd8c0d2cf100594be24d6e16a9 Mon Sep 17 00:00:00 2001 From: kaneap <1998alexkane@gmail.com> Date: Fri, 30 Jun 2023 20:09:50 +0200 Subject: [PATCH 1/4] add non-null score to bus stop for higher rendering --- project.mml | 1 + 1 file changed, 1 insertion(+) diff --git a/project.mml b/project.mml index 28e90cb42..ecd9dcf46 100644 --- a/project.mml +++ b/project.mml @@ -1634,6 +1634,7 @@ Layer: CASE WHEN tags->'height' ~ '^\d{1,3}(\.\d+)?( m)?$' THEN (SUBSTRING(tags->'height', '^(\d{1,3}(\.\d+)?)( m)?$'))::NUMERIC END + WHEN "highway" IN ('bus_stop') THEN 0 --renders bus stops above other amenity points, such as bus shelters END AS score, religion, tags->'denomination' as denomination, From ab3cc8798644b7255354a8e0bbe21801bba99fab Mon Sep 17 00:00:00 2001 From: kaneap <35740782+kaneap@users.noreply.github.com> Date: Sat, 1 Jul 2023 16:44:38 +0200 Subject: [PATCH 2/4] order partially by min zoom level for amenity points levels 1-15 add minzoom so that they render with the correct priority (i.e. low zoom features don't get covered by ones that appear at higher levels) --- project.mml | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 134 insertions(+), 2 deletions(-) diff --git a/project.mml b/project.mml index 28e90cb42..1f50b2c0f 100644 --- a/project.mml +++ b/project.mml @@ -1531,7 +1531,137 @@ Layer: <<: *osm2pgsql table: &amenity_points_sql |- (SELECT - * + *, + CASE + WHEN feature IN ('place_island') + AND way_pixels > 3000 + THEN 4 + WHEN feature IN ('landuse_military','natural_wood', 'landuse_forest','boundary_national_park','leisure_nature_reserve', + 'boundary_aboriginal_lands','boundary_protected_area', 'natural_sand', 'natural_bare_rock') + AND way_pixels > 3000 + AND is_building = 'no' + THEN 8 + WHEN feature IN ('natural_glacier') + AND way_pixels > 10000 + AND is_building = 'no' + THEN 8 + WHEN feature IN ('natural_scree', 'natural_shingle', 'military_danger_area') + AND way_pixels > 3000 + AND is_building = 'no' + THEN 9 + WHEN feature IN ('aeroway_aerodrome') + AND int_access = 'yes' + AND 'icao' != null + AND 'iata' != null + THEN 10 + WHEN feature in ('natural_wetland','natural_mud', 'leisure_park', 'landuse_recreation_ground', 'landuse_village_green', 'leisure_garden', + 'landuse_quarry', 'landuse_vineyard', 'landuse_orchard', 'landuse_plant_nursery', 'landuse_cemetery', 'amenity_grave_yard', + 'landuse_residential', 'landuse_meadow', 'natural_grassland', 'landuse_grass', 'landuse_allotments', 'landuse_farmyard', + 'landuse_farmland', 'landuse_greenhouse_horticulture', 'landuse_retail', 'landuse_industrial', 'landuse_railway', + 'man_made_works', 'man_made_water_works', 'man_made_wastewater_plant', 'landuse_commercial', 'landuse_brownfield', + 'landuse_landfill', 'landuse_construction', 'landuse_salt_pond', 'tourism_theme_park', 'tourism_zoo', 'amenity_kindergarten', + 'amenity_school', 'amenity_college', 'amenity_university', 'landuse_religious', 'natural_heath', 'natural_scrub', 'natural_beach', + 'natural_shoal', 'natural_reef', 'leisure_fitness_centre', 'leisure_fitness_station', 'leisure_sports_centre', 'leisure_stadium', + 'leisure_track', 'leisure_dog_park', 'leisure_ice_rink', 'leisure_pitch) + AND way_pixels > 3000 + And is_building = 'no' + THEN 10 + WHEN feature in ('shop') + AND shop = 'mall' + AND location != 'underground' + AND way_pixels > 3000 + THEN 10 + WHEN feature IN ('power_plant', 'aeroway_apron', 'highway_services', 'highway_rest_area') + AND is_building = 'no' + AND way_pixels > 3000 + THEN 10 + WHEN feature IN ('power_generator') + AND generator:source != 'wind' + AND is_building = 'no' + THEN 10 + WHEN feature IN ('natural_glacier') + AND way_pixels > 750 + AND is_building = 'no' + THEN 10 + WHEN feature in ('natural_peak', 'natural_volcano') + THEN 11 + WHEN feature in ('place_islet') + AND way_pixels > 3000 + THEN 11 + WHEN feature IN ('aeroway_aerodrome') + AND (int_access = 'restricted' OR 'icao' != null OR 'iata' != null) + THEN 12 + WHEN feature IN ('waterway_waterfall') + AND height > 20 + THEN 13 + WHEN feature IN ('tourism_alpine_hut', 'tourism_wilderness_hut') + THEN 13 + WHEN feature IN ('landuse_garages, 'power_substation') + AND is_building = 'no' + AND way_pixels > 3000 + THEN 13 + WHEN feature IN ('man_made_mast") + AND "tower:type" != 'lighting' + AND height >= 160 + THEN 14 + WHEN feature IN ('man_made_tower') + AND "tower:type" NOT IN ('cooling', 'lighting', 'bell_tower', 'watchtower') + AND height >= 160 + THEN 14 + WHEN feature IN ('man_made_communications_tower', 'natural_spring', 'railway_level_crossing', 'natural_cape') + THEN 14 + WHEN feature IN ('man_made_telescope') + AND "telescope:type" IS NOT NULL + AND "telescope:type" != 'optical' + AND "telescope:diameter" >= 60 + THEN 14 + WHEN feature IN ('man_made_telescope') + AND ("telescope:type" != 'optical' OR "telescope:type" IS NULL) + AND "telescope:diameter" >= 8 + THEN 14 + WHEN feature IN ('waterway_waterfall') + AND height > 10 + THEN 14 + WHEN feature in ('amenity_parking', 'amenity_bicycle_parking', 'amenity_motorcycle_parking', 'amenity_parking_entrance') + AND way_pixels > 750 + AND parking NOT IN ('street_side', 'lane') + THEN 14 + WHEN feature in ('leisure_water_park', 'leisure_swimming_area', 'leisure_playground', 'leisure_dog_park', 'leisure_fitness_centre', + 'leisure_fitness_station') + AND way_pixels > 3000 + THEN 14 + WHEN feature in ('leisure_sports_centre') + AND sport = 'swimming' + AND way_pixels > 3000 + THEN 14 + WHEN feature IN ('man_made_mast") + AND "tower:type" != 'lighting' + AND height >= 80 + THEN 15 + WHEN feature IN ('man_made_tower') + AND "tower:type" NOT IN ('lighting', 'bell_tower', 'watchtower') + AND height >= 80 + THEN 15 + WHEN feature IN ('man_made_telescope') + AND "telescope:type" IS NOT NULL + AND "telescope:type" != 'optical' + AND "telescope:diameter" >= 30 + THEN 15 + WHEN feature IN ('man_made_telescope') + AND ("telescope:type" != 'optical' OR "telescope:type" IS NULL) + AND "telescope:diameter" >=4 + THEN 15 + WHEN feature IN ('amenity_hospital', 'historic_castle', 'leisure_golf_course', 'amenity_ferry_terminal', 'man_made_lighthouse', 'natural_saddle', + 'mountain_pass', 'natural_cave_entrance', 'natural_cave_entrance', 'leisure_marina', 'railway_crossing') + AND castle_type NOT IN ('stately', 'manor') + THEN 15 + WHEN feature IN ('waterway_waterfall') + AND name IS NOT NULL + WHEN feature IN ('power_generator') + AND "generator:source" = 'wind' + AND (location IS NULL OR location NOT IN ('rooftop', 'roof')) + THEN 15 + END AS minzoom, FROM (SELECT -- This subselect allows filtering on the feature column way, @@ -1741,7 +1871,9 @@ Layer: ) _ ) AS features WHERE feature IS NOT NULL - ORDER BY score DESC NULLS LAST, + ORDER BY + minzoom ASC NULLS LAST, + score DESC NULLS LAST, way_pixels DESC NULLS LAST ) AS amenity_points properties: From 1bb1155ca6713935ad3e184817d3eb04c823aa42 Mon Sep 17 00:00:00 2001 From: kaneap <1998alexkane@gmail.com> Date: Sat, 1 Jul 2023 18:01:33 +0200 Subject: [PATCH 3/4] fix formatting errors --- project.mml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/project.mml b/project.mml index 1f50b2c0f..4b1ef627b 100644 --- a/project.mml +++ b/project.mml @@ -1562,9 +1562,9 @@ Layer: 'landuse_landfill', 'landuse_construction', 'landuse_salt_pond', 'tourism_theme_park', 'tourism_zoo', 'amenity_kindergarten', 'amenity_school', 'amenity_college', 'amenity_university', 'landuse_religious', 'natural_heath', 'natural_scrub', 'natural_beach', 'natural_shoal', 'natural_reef', 'leisure_fitness_centre', 'leisure_fitness_station', 'leisure_sports_centre', 'leisure_stadium', - 'leisure_track', 'leisure_dog_park', 'leisure_ice_rink', 'leisure_pitch) + 'leisure_track', 'leisure_dog_park', 'leisure_ice_rink', 'leisure_pitch') AND way_pixels > 3000 - And is_building = 'no' + AND is_building = 'no' THEN 10 WHEN feature in ('shop') AND shop = 'mall' @@ -1576,7 +1576,7 @@ Layer: AND way_pixels > 3000 THEN 10 WHEN feature IN ('power_generator') - AND generator:source != 'wind' + AND "generator:source" != 'wind' AND is_building = 'no' THEN 10 WHEN feature IN ('natural_glacier') @@ -1596,11 +1596,11 @@ Layer: THEN 13 WHEN feature IN ('tourism_alpine_hut', 'tourism_wilderness_hut') THEN 13 - WHEN feature IN ('landuse_garages, 'power_substation') + WHEN feature IN ('landuse_garages', 'power_substation') AND is_building = 'no' AND way_pixels > 3000 THEN 13 - WHEN feature IN ('man_made_mast") + WHEN feature IN ('man_made_mast') AND "tower:type" != 'lighting' AND height >= 160 THEN 14 @@ -1634,7 +1634,7 @@ Layer: AND sport = 'swimming' AND way_pixels > 3000 THEN 14 - WHEN feature IN ('man_made_mast") + WHEN feature IN ('man_made_mast') AND "tower:type" != 'lighting' AND height >= 80 THEN 15 @@ -1657,11 +1657,12 @@ Layer: THEN 15 WHEN feature IN ('waterway_waterfall') AND name IS NOT NULL + THEN 15 WHEN feature IN ('power_generator') AND "generator:source" = 'wind' AND (location IS NULL OR location NOT IN ('rooftop', 'roof')) THEN 15 - END AS minzoom, + END AS minzoom FROM (SELECT -- This subselect allows filtering on the feature column way, From 98ab089b070687e1171bc87cc8ffdc9c9af80cda Mon Sep 17 00:00:00 2001 From: kaneap <35740782+kaneap@users.noreply.github.com> Date: Sun, 2 Jul 2023 00:54:47 +0200 Subject: [PATCH 4/4] reorganize cases for minzoom --- project.mml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/project.mml b/project.mml index 75f1d2966..c2ea25eb3 100644 --- a/project.mml +++ b/project.mml @@ -1562,7 +1562,8 @@ Layer: 'landuse_landfill', 'landuse_construction', 'landuse_salt_pond', 'tourism_theme_park', 'tourism_zoo', 'amenity_kindergarten', 'amenity_school', 'amenity_college', 'amenity_university', 'landuse_religious', 'natural_heath', 'natural_scrub', 'natural_beach', 'natural_shoal', 'natural_reef', 'leisure_fitness_centre', 'leisure_fitness_station', 'leisure_sports_centre', 'leisure_stadium', - 'leisure_track', 'leisure_dog_park', 'leisure_ice_rink', 'leisure_pitch') + 'leisure_track', 'leisure_dog_park', 'leisure_ice_rink', 'leisure_pitch', 'power_plant', 'aeroway_apron', 'highway_services', + 'highway_rest_area') AND way_pixels > 3000 AND is_building = 'no' THEN 10 @@ -1571,10 +1572,6 @@ Layer: AND location != 'underground' AND way_pixels > 3000 THEN 10 - WHEN feature IN ('power_plant', 'aeroway_apron', 'highway_services', 'highway_rest_area') - AND is_building = 'no' - AND way_pixels > 3000 - THEN 10 WHEN feature IN ('power_generator') AND "generator:source" != 'wind' AND is_building = 'no' @@ -1589,14 +1586,13 @@ Layer: AND way_pixels > 3000 THEN 11 WHEN feature IN ('aeroway_aerodrome') - AND (int_access = 'restricted' OR 'icao' != null OR 'iata' != null) THEN 12 + WHEN feature IN ('tourism_alpine_hut', 'tourism_wilderness_hut') + THEN 13 WHEN feature IN ('waterway_waterfall') AND height > 20 THEN 13 - WHEN feature IN ('tourism_alpine_hut', 'tourism_wilderness_hut') - THEN 13 - WHEN feature IN ('landuse_garages', 'power_substation') + WHEN feature IN ('landuse_garages', 'power_substation', 'leisure_swimming_pool') AND is_building = 'no' AND way_pixels > 3000 THEN 13 @@ -1765,7 +1761,8 @@ Layer: CASE WHEN tags->'height' ~ '^\d{1,3}(\.\d+)?( m)?$' THEN (SUBSTRING(tags->'height', '^(\d{1,3}(\.\d+)?)( m)?$'))::NUMERIC END - WHEN "highway" IN ('bus_stop') THEN 0 --renders bus stops above other amenity points, such as bus shelters + WHEN "amenity" IN ('bus_station') THEN 1 + WHEN "highway" IN ('bus_stop') THEN 0 --renders bus stops above other zoom 16 amenity points, such as bus shelters END AS score, religion, tags->'denomination' as denomination,