Routes of Ireland (#1466)

This PR follows #1465 to implement pseudo-route relations for Republic of Ireland road routes as described in the [OSM wiki](https://wiki.openstreetmap.org/wiki/Ireland/Roads). Irish road routes work in the same way as UK road routes in that signage is derived from highway classification on a 1:1 basis. The scheme described in the OSM wiki is confirmed via [overpass query](https://overpass-turbo.eu/s/1por).

This feature follows the implementation currently used for UK road routes, in which a 10m Natural Earth polygon is used to determine which roads are located within Ireland to apply this processing.

This PR implements 3 classes of routes:
* M-roads, which are `highway=motorway` and signed with blue/white lettering.
* N-roads ("national roads"), which are `highway=trunk` or `highway=primary` and are signed with green/yellow lettering.
* R- and L-roads ("regional and local roads"), which are `highway=secondary`, `highway=tertiary` or `highway=unclassified`, and signed with white/black lettering
pull/1475/head^2
Brian Sperlongano 2023-01-15 07:52:43 -05:00 zatwierdzone przez GitHub
rodzic 8b5aa3273e
commit edb42f2db3
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
5 zmienionych plików z 61 dodań i 7 usunięć

Plik binarny nie jest wyświetlany.

Przed

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

Po

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

Wyświetl plik

@ -16,7 +16,8 @@ $$
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-primary'
'gb-motorway', 'gb-trunk', 'gb-primary',
'ie-motorway', 'ie-national', 'ie-regional'
);
END
$$;

Wyświetl plik

@ -127,7 +127,8 @@ layer:
The network type derived mainly from [`network`](http://wiki.openstreetmap.org/wiki/Key:network) tag of the road.
See more info about [`us-*`](http://wiki.openstreetmap.org/wiki/Road_signs_in_the_United_States),
[`ca-transcanada`](https://en.wikipedia.org/wiki/Trans-Canada_Highway),
or [`gb-*`](http://wiki.openstreetmap.org/wiki/United_Kingdom_Tagging_Guidelines#UK_roads).
[`gb-*`](http://wiki.openstreetmap.org/wiki/United_Kingdom_Tagging_Guidelines#UK_roads),
or [`ie-*`](http://wiki.openstreetmap.org/wiki/Ireland/Roads).
brunnel:
description: |
Mark whether way is a tunnel or bridge.

Wyświetl plik

@ -1,9 +1,20 @@
-- Create bounding windows for country-specific processing
-- etldoc: ne_10m_admin_0_countries -> ne_10m_admin_0_gb_buffer
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
-- etldoc: ne_10m_admin_0_countries -> ne_10m_admin_0_ie_buffer
CREATE TABLE IF NOT EXISTS ne_10m_admin_0_ie_buffer AS
SELECT ST_Buffer(geometry, 10000)
FROM ne_10m_admin_0_countries
WHERE iso_a2 = 'IE';
-- Assign pseudo-networks based highway classification
-- etldoc: osm_highway_linestring -> gbr_route_members_view
-- etldoc: ne_10m_admin_0_gb_buffer -> gbr_route_members_view
CREATE OR REPLACE VIEW gbr_route_members_view AS
SELECT 0,
osm_id,
@ -17,15 +28,40 @@ 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)
-- etldoc: osm_highway_linestring -> ire_route_members_view
-- etldoc: ne_10m_admin_0_ie_buffer -> ire_route_members_view
CREATE OR REPLACE VIEW ire_route_members_view AS
SELECT 0,
osm_id,
substring(ref FROM E'^[MNRL][0-9]+'),
-- See https://wiki.openstreetmap.org/wiki/Ireland/Roads
CASE WHEN highway = 'motorway' THEN 'omt-ie-motorway'
WHEN highway IN ('trunk','primary') THEN 'omt-ie-national'
ELSE 'omt-ie-regional' END AS network
FROM osm_highway_linestring
WHERE length(ref) > 1
AND ST_Intersects(geometry, (SELECT * FROM ne_10m_admin_0_ie_buffer))
AND highway IN ('motorway', 'trunk', 'primary', 'secondary', 'unclassified')
;
-- Create GBR/IRE relations (so we can use it in the same way as other relations)
-- etldoc: osm_route_member -> osm_route_member
DELETE
FROM osm_route_member
WHERE network IN ('omt-gb-motorway', 'omt-gb-trunk', 'omt-gb-primary');
WHERE network IN ('omt-gb-motorway', 'omt-gb-trunk', 'omt-gb-primary',
'omt-ie-motorway', 'omt-ie-national', 'omt-ie-national');
-- etldoc: gbr_route_members_view -> osm_route_member
INSERT INTO osm_route_member (osm_id, member, ref, network)
SELECT *
FROM gbr_route_members_view;
-- etldoc: ire_route_members_view -> osm_route_member
INSERT INTO osm_route_member (osm_id, member, ref, network)
SELECT *
FROM ire_route_members_view;
CREATE OR REPLACE FUNCTION osm_route_member_network_type(network text, ref text) RETURNS route_network_type AS
$$
SELECT CASE
@ -48,7 +84,10 @@ SELECT CASE
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;
WHEN network = 'omt-ie-motorway' THEN 'ie-motorway'::route_network_type
WHEN network = 'omt-ie-national' THEN 'ie-national'::route_network_type
WHEN network = 'omt-ie-regional' THEN 'ie-regional'::route_network_type
END;
$$ LANGUAGE sql IMMUTABLE
PARALLEL SAFE;
@ -67,7 +106,8 @@ BEGIN
FROM osm_route_member AS r
USING
transportation_name.network_changes AS c
WHERE network IN ('omt-gb-motorway', 'omt-gb-trunk', 'omt-gb-primary')
WHERE network IN ('omt-gb-motorway', 'omt-gb-trunk', 'omt-gb-primary',
'omt-ie-motorway', 'omt-ie-national', 'omt-ie-regional')
AND r.osm_id = c.osm_id;
INSERT INTO osm_route_member (osm_id, member, ref, network)
@ -76,6 +116,12 @@ BEGIN
JOIN transportation_name.network_changes AS c ON
r.osm_id = c.osm_id;
INSERT INTO osm_route_member (osm_id, member, ref, network)
SELECT r.*
FROM ire_route_members_view AS r
JOIN transportation_name.network_changes AS c ON
r.osm_id = c.osm_id;
INSERT INTO osm_route_member (id, osm_id, network_type, concurrency_index, rank)
SELECT
id,
@ -110,6 +156,7 @@ ALTER TABLE osm_route_member ADD COLUMN IF NOT EXISTS concurrency_index int,
ADD COLUMN IF NOT EXISTS rank int;
-- One-time load of concurrency indexes; updates occur via trigger
-- etldoc: osm_route_member -> osm_route_member
INSERT INTO osm_route_member (id, osm_id, concurrency_index, rank)
SELECT
id,
@ -123,11 +170,13 @@ INSERT INTO osm_route_member (id, osm_id, concurrency_index, rank)
FROM osm_route_member
ON CONFLICT (id, osm_id) DO UPDATE SET concurrency_index = EXCLUDED.concurrency_index, rank = EXCLUDED.rank;
-- etldoc: osm_route_member -> osm_highway_linestring
UPDATE osm_highway_linestring hl
SET network = rm.network_type
FROM osm_route_member rm
WHERE hl.osm_id=rm.member AND rm.concurrency_index=1;
-- etldoc: osm_route_member -> osm_highway_linestring_gen_z11
UPDATE osm_highway_linestring_gen_z11 hl
SET network = rm.network_type
FROM osm_route_member rm

Wyświetl plik

@ -33,6 +33,9 @@ layer:
- gb-motorway
- gb-trunk
- gb-primary
- ie-motorway
- ie-national
- ie-regional
- road (default)
class:
description: |