Add GB primary/secondary routes (#1465)

This PR adds an additional pseudo-network for UK non-primary [routes](https://en.wikipedia.org/wiki/Great_Britain_road_numbering_scheme), which are signed with black on white signage with "A" and "B" prefixes. This scheme is described on the [OSM wiki](https://wiki.openstreetmap.org/wiki/Roads_in_the_United_Kingdom). Adding this third psuedo network is needed for generating shields for UK white/black signage for non-primary routes. 
Additionally, this fixes a minor bug under which single-digit refs would have been included.  Single-digit refs don't exist in the UK, because the numbering scheme is always prefixed by a letter, e.g. "A4".

I also included documentation updates and fixed the typo where a view was named "bg" instead of "gb".
pull/1470/head^2
Brian Sperlongano 2023-01-10 08:50:24 -05:00 zatwierdzone przez GitHub
rodzic af8c6883dd
commit 5f7b2c11b3
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
4 zmienionych plików z 16 dodań i 10 usunięć

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 538 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 640 KiB

Wyświetl plik

@ -16,7 +16,7 @@ $$
CREATE TYPE route_network_type AS enum (
'us-interstate', 'us-highway', 'us-state',
'ca-transcanada', 'ca-provincial-arterial', 'ca-provincial',
'gb-motorway', 'gb-trunk'
'gb-motorway', 'gb-trunk', 'gb-primary'
);
END
$$;

Wyświetl plik

@ -1,23 +1,27 @@
CREATE TABLE IF NOT EXISTS ne_10m_admin_0_bg_buffer AS
CREATE TABLE IF NOT EXISTS ne_10m_admin_0_gb_buffer AS
SELECT ST_Buffer(geometry, 10000)
FROM ne_10m_admin_0_countries
WHERE iso_a2 = 'GB';
-- etldoc: osm_route_member -> gbr_route_members_view
CREATE OR REPLACE VIEW gbr_route_members_view AS
SELECT 0,
osm_id,
substring(ref FROM E'^[AM][0-9AM()]+'),
CASE WHEN highway = 'motorway' THEN 'omt-gb-motorway' ELSE 'omt-gb-trunk' END
substring(ref FROM E'^[ABM][0-9ABM()]+'),
-- See https://wiki.openstreetmap.org/wiki/Roads_in_the_United_Kingdom
CASE WHEN highway = 'motorway' THEN 'omt-gb-motorway'
WHEN highway = 'trunk' THEN 'omt-gb-trunk'
WHEN highway IN ('primary','secondary') THEN 'omt-gb-primary' END AS network
FROM osm_highway_linestring
WHERE length(ref) > 0
AND ST_Intersects(geometry, (SELECT * FROM ne_10m_admin_0_bg_buffer))
AND highway IN ('motorway', 'trunk')
WHERE length(ref) > 1
AND ST_Intersects(geometry, (SELECT * FROM ne_10m_admin_0_gb_buffer))
AND highway IN ('motorway', 'trunk', 'primary', 'secondary')
;
-- Create GBR relations (so we can use it in the same way as other relations)
DELETE
FROM osm_route_member
WHERE network IN ('omt-gb-motorway', 'omt-gb-trunk');
-- etldoc: osm_highway_linestring -> osm_route_member
WHERE network IN ('omt-gb-motorway', 'omt-gb-trunk', 'omt-gb-primary');
-- etldoc: gbr_route_members_view -> osm_route_member
INSERT INTO osm_route_member (osm_id, member, ref, network)
SELECT *
FROM gbr_route_members_view;
@ -43,6 +47,7 @@ SELECT CASE
WHEN network LIKE 'CA:__' OR network LIKE 'CA:__:%' THEN 'ca-provincial'::route_network_type
WHEN network = 'omt-gb-motorway' THEN 'gb-motorway'::route_network_type
WHEN network = 'omt-gb-trunk' THEN 'gb-trunk'::route_network_type
WHEN network = 'omt-gb-primary' THEN 'gb-primary'::route_network_type
END;
$$ LANGUAGE sql IMMUTABLE
PARALLEL SAFE;
@ -62,7 +67,7 @@ BEGIN
FROM osm_route_member AS r
USING
transportation_name.network_changes AS c
WHERE network IN ('omt-gb-motorway', 'omt-gb-trunk')
WHERE network IN ('omt-gb-motorway', 'omt-gb-trunk', 'omt-gb-primary')
AND r.osm_id = c.osm_id;
INSERT INTO osm_route_member (osm_id, member, ref, network)

Wyświetl plik

@ -32,6 +32,7 @@ layer:
- ca-provincial
- gb-motorway
- gb-trunk
- gb-primary
- road (default)
class:
description: |