[WIP] Expanded road route attributes (#1620)
This PR replaces the `route_N` attribute scheme with individual attributes for name and colour on routes. Thus you will have: * `route_N_network` to hold the route `network` value * `route_N_ref` to hold the route `ref` value * `route_N_name` to hold the route `name` value * `route_N_colour` to hold the route `colour` or `ref:colour` value
This commit is contained in:
committed by
GitHub
parent
ee8259ced5
commit
b3c32321a3
@@ -102,10 +102,6 @@ name_de_field: &name_de
|
||||
name: name_de
|
||||
key: name:de
|
||||
type: string
|
||||
short_name_field: &short_name
|
||||
key: short_name
|
||||
name: short_name
|
||||
type: string
|
||||
tunnel_field: &tunnel
|
||||
key: tunnel
|
||||
name: is_tunnel
|
||||
@@ -236,7 +232,6 @@ tables:
|
||||
- *name_de
|
||||
- name: tags
|
||||
type: hstore_tags
|
||||
- *short_name
|
||||
- *tunnel
|
||||
- *bridge
|
||||
- *ramp
|
||||
@@ -316,7 +311,6 @@ tables:
|
||||
- *name_de
|
||||
- name: tags
|
||||
type: hstore_tags
|
||||
- *short_name
|
||||
- *tunnel
|
||||
- *bridge
|
||||
- *ramp
|
||||
@@ -354,7 +348,6 @@ tables:
|
||||
- *name_de
|
||||
- name: tags
|
||||
type: hstore_tags
|
||||
- *short_name
|
||||
- *tunnel
|
||||
- *bridge
|
||||
- *ramp
|
||||
@@ -393,7 +386,6 @@ tables:
|
||||
- *name_de
|
||||
- name: tags
|
||||
type: hstore_tags
|
||||
- *short_name
|
||||
- *tunnel
|
||||
- *bridge
|
||||
- *ramp
|
||||
@@ -491,6 +483,9 @@ tables:
|
||||
- name: colour
|
||||
key: colour
|
||||
type: string
|
||||
- name: ref_colour
|
||||
key: ref:colour
|
||||
type: string
|
||||
mapping:
|
||||
route:
|
||||
- road
|
||||
|
||||
@@ -39,3 +39,15 @@ $$
|
||||
);
|
||||
$$ LANGUAGE sql IMMUTABLE
|
||||
PARALLEL SAFE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION create_route_hstore(network TEXT, ref TEXT, name TEXT, colour TEXT, ref_colour TEXT)
|
||||
RETURNS hstore AS $$
|
||||
SELECT CASE
|
||||
WHEN network = '' THEN hstore('')
|
||||
ELSE hstore(
|
||||
ARRAY['network', 'ref', 'name', 'colour'],
|
||||
ARRAY[network, NULLIF(ref, ''), NULLIF(name, ''), COALESCE(NULLIF(colour, ''), NULLIF(ref_colour, ''))]
|
||||
)
|
||||
END;
|
||||
$$ LANGUAGE sql IMMUTABLE
|
||||
PARALLEL SAFE;
|
||||
|
||||
@@ -90,6 +90,7 @@ CREATE TABLE IF NOT EXISTS transportation_route_member_coalesced
|
||||
name varchar,
|
||||
osmc_symbol varchar,
|
||||
colour varchar,
|
||||
ref_colour varchar,
|
||||
network_type route_network_type,
|
||||
concurrency_index integer,
|
||||
rank integer,
|
||||
@@ -164,7 +165,8 @@ BEGIN
|
||||
type,
|
||||
name,
|
||||
osmc_symbol,
|
||||
colour
|
||||
colour,
|
||||
ref_colour
|
||||
FROM osm_route_member
|
||||
WHERE full_update OR EXISTS(
|
||||
SELECT NULL
|
||||
@@ -174,7 +176,7 @@ BEGIN
|
||||
) osm_route_member_filtered
|
||||
ON CONFLICT (member, network, ref) DO UPDATE SET osm_id = EXCLUDED.osm_id, role = EXCLUDED.role,
|
||||
type = EXCLUDED.type, name = EXCLUDED.name,
|
||||
osmc_symbol = EXCLUDED.osmc_symbol, colour = EXCLUDED.colour,
|
||||
osmc_symbol = EXCLUDED.osmc_symbol, colour = EXCLUDED.colour, ref_colour = EXCLUDED.ref_colour,
|
||||
concurrency_index = EXCLUDED.concurrency_index,
|
||||
rank = EXCLUDED.rank;
|
||||
END;
|
||||
|
||||
@@ -84,12 +84,12 @@ FROM (
|
||||
CASE WHEN highway IN ('footway', 'steps') THEN layer END AS layer,
|
||||
CASE WHEN highway IN ('footway', 'steps') THEN level END AS level,
|
||||
CASE WHEN highway IN ('footway', 'steps') THEN indoor END AS indoor,
|
||||
NULLIF(rm1.network, '') || '=' || COALESCE(rm1.ref, '') AS route_1,
|
||||
NULLIF(rm2.network, '') || '=' || COALESCE(rm2.ref, '') AS route_2,
|
||||
NULLIF(rm3.network, '') || '=' || COALESCE(rm3.ref, '') AS route_3,
|
||||
NULLIF(rm4.network, '') || '=' || COALESCE(rm4.ref, '') AS route_4,
|
||||
NULLIF(rm5.network, '') || '=' || COALESCE(rm5.ref, '') AS route_5,
|
||||
NULLIF(rm6.network, '') || '=' || COALESCE(rm6.ref, '') AS route_6,
|
||||
create_route_hstore(rm1.network, rm1.ref, rm1.name, rm1.colour, rm1.ref_colour) AS route_1,
|
||||
create_route_hstore(rm2.network, rm2.ref, rm2.name, rm2.colour, rm2.ref_colour) AS route_2,
|
||||
create_route_hstore(rm3.network, rm3.ref, rm3.name, rm3.colour, rm3.ref_colour) AS route_3,
|
||||
create_route_hstore(rm4.network, rm4.ref, rm4.name, rm4.colour, rm4.ref_colour) AS route_4,
|
||||
create_route_hstore(rm5.network, rm5.ref, rm5.name, rm5.colour, rm5.ref_colour) AS route_5,
|
||||
create_route_hstore(rm6.network, rm6.ref, rm6.name, rm6.colour, rm6.ref_colour) AS route_6,
|
||||
hl.z_order,
|
||||
LEAST(rm1.rank, rm2.rank, rm3.rank, rm4.rank, rm5.rank, rm6.rank) AS route_rank
|
||||
FROM osm_highway_linestring hl
|
||||
|
||||
Reference in New Issue
Block a user