Add ca-transcanada network type

pull/185/head
jirik 2017-03-03 14:05:39 +01:00
rodzic 3af0204564
commit 7459cbe9c3
3 zmienionych plików z 21 dodań i 2 usunięć

Wyświetl plik

@ -224,6 +224,7 @@ tables:
type: member_type
- *ref
- *network
- *name
mapping:
route:
- road

Wyświetl plik

@ -15,7 +15,7 @@ CREATE MATERIALIZED VIEW osm_transportation_name_network AS (
COALESCE(NULLIF(hl.name_en, ''), hl.name) AS name_en,
rm.network_type,
CASE
WHEN rm.network_type is not null
WHEN (rm.network_type is not null AND nullif(rm.ref::text, '') is not null)
then rm.ref::text
else hl.ref
end as ref,

Wyświetl plik

@ -8,7 +8,8 @@ DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'route_network_type') THEN
CREATE TYPE route_network_type AS ENUM (
'us-interstate', 'us-highway', 'us-state'
'us-interstate', 'us-highway', 'us-state',
'ca-transcanada'
);
END IF;
END
@ -33,6 +34,23 @@ SET network_type =
WHEN network = 'US:I' THEN 'us-interstate'::route_network_type
WHEN network = 'US:US' THEN 'us-highway'::route_network_type
WHEN network LIKE 'US:__' THEN 'us-state'::route_network_type
-- https://en.wikipedia.org/wiki/Trans-Canada_Highway
-- TODO: improve hierarchical queries using
-- http://www.openstreetmap.org/relation/1307243
-- however the relation does not cover the whole Trans-Canada_Highway
WHEN
(network = 'CA:transcanada') OR
(network = 'CA:BC:primary' AND ref IN ('16')) OR
(name = 'Yellowhead Highway (AB)' AND ref IN ('16')) OR
(network = 'CA:SK' AND ref IN ('16')) OR
(network = 'CA:ON:primary' AND ref IN ('17', '417')) OR
(name = 'Route Transcanadienne (QC)') OR
(network = 'CA:NB' AND ref IN ('2', '16')) OR
(network = 'CA:PEI' AND ref IN ('1')) OR
(network = 'CA:NS' AND ref IN ('104', '105')) OR
(network = 'CA:NL:R' AND ref IN ('1')) OR
(name = ' Trans-Canada Highway (Super)')
THEN 'ca-transcanada'::route_network_type
ELSE NULL
END
;