From 3c156795558a4097083fd3899ec8c88ced9862fe Mon Sep 17 00:00:00 2001 From: Brian Sperlongano Date: Tue, 13 Jul 2021 08:44:59 -0400 Subject: [PATCH] Update brunnel aggregation to avoid splitting highways (#1141) Fixes #1131 This change does the following: 1. Excludes roads from `transportation_name` that don't have a `name` or a `ref` 2. Updates the road name merging logic to exclude changes in `brunnel` status. This will ensure that minor bridges don't disrupt the continuity of named roads as the map zooms out. 3. The `brunnel` tag will now only be set when a bridge or tunnel is distinctly named. Distinctly named is defined as "has a different name from the road on either side". This example shows an unnamed interstate highway rendered as a continuous feature at low zoom. This road has many small bridges along its length: ![image](https://user-images.githubusercontent.com/3254090/124370289-b30faa80-dc43-11eb-80d6-034c18ce99ad.png) This example shows a named bridge rendered with `brunnel` tag set: ![image](https://user-images.githubusercontent.com/3254090/124370298-d0dd0f80-dc43-11eb-8a78-183420a6bd62.png) --- layers/transportation_name/update_transportation_name.sql | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/layers/transportation_name/update_transportation_name.sql b/layers/transportation_name/update_transportation_name.sql index d12cbab..b5f0dc5 100644 --- a/layers/transportation_name/update_transportation_name.sql +++ b/layers/transportation_name/update_transportation_name.sql @@ -79,14 +79,17 @@ FROM ( ref, highway, subclass, - brunnel, + CASE WHEN COUNT(*) = COUNT(brunnel) AND MAX(brunnel) = MIN(brunnel) + THEN MAX(brunnel) + ELSE NULL::text END AS brunnel, "level", layer, indoor, network_type, min(z_order) AS z_order FROM osm_transportation_name_network - GROUP BY name, name_en, name_de, tags, ref, highway, subclass, brunnel, "level", layer, indoor, network_type + WHERE name <> '' OR ref <> '' + GROUP BY name, name_en, name_de, tags, ref, highway, subclass, "level", layer, indoor, network_type ) AS highway_union ; CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_name_ref_idx ON osm_transportation_name_linestring (coalesce(name, ''), coalesce(ref, ''));