Add bicycle routes

pull/1696/head
Brian Sperlongano 2024-11-26 22:31:06 -05:00
rodzic a74fb442d8
commit 2634b52fe6
7 zmienionych plików z 53 dodań i 18 usunięć

Wyświetl plik

@ -477,6 +477,12 @@ tables:
- *ref
- *network
- *name
- name: route
key: route
type: string
- name: cycle_network
key: cycle_network
type: string
- name: osmc_symbol
key: osmc:symbol
type: string
@ -488,5 +494,6 @@ tables:
type: string
mapping:
route:
- road
- bicycle
- hiking
- road

Wyświetl plik

@ -44,13 +44,19 @@ $$
$$ LANGUAGE sql IMMUTABLE
PARALLEL SAFE;
CREATE OR REPLACE FUNCTION create_route_hstore(network TEXT, ref TEXT, name TEXT, colour TEXT, ref_colour TEXT)
CREATE OR REPLACE FUNCTION create_route_hstore(network TEXT, cycle_network TEXT, route 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, ''))]
ARRAY['network', 'route', 'ref', 'name', 'colour'],
ARRAY[
CASE WHEN route = 'bicycle' THEN NULLIF(cycle_network, '') ELSE NULLIF(network, '') END,
NULLIF(route, ''),
NULLIF(ref, ''),
NULLIF(name, ''),
COALESCE(NULLIF(colour, ''), NULLIF(ref_colour, ''))
]
)
END;
$$ LANGUAGE sql IMMUTABLE

Wyświetl plik

@ -79,6 +79,8 @@ CREATE TABLE IF NOT EXISTS transportation_route_member_coalesced
(
member bigint,
network varchar,
cycle_network varchar,
route varchar,
ref varchar,
osm_id bigint not null,
role varchar,
@ -128,6 +130,8 @@ BEGIN
SELECT DISTINCT ON (member, COALESCE(rel.network, ''), COALESCE(rel.ref, ''))
rel.member,
COALESCE(NULLIF(rel.network,''), gb_way.network, ir_way.network, '') AS network,
NULLIF(rel.cycle_network,'') AS cycle_network,
NULLIF(rel.route, '') AS route,
COALESCE(rel.ref, '') AS ref,
osm_id,
role,

Wyświetl plik

@ -102,12 +102,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,
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,
create_route_hstore(rm1.network, rm1.cycle_network, rm1.route, rm1.ref, rm1.name, rm1.colour, rm1.ref_colour) AS route_1,
create_route_hstore(rm2.network, rm2.cycle_network, rm2.route, rm2.ref, rm2.name, rm2.colour, rm2.ref_colour) AS route_2,
create_route_hstore(rm3.network, rm3.cycle_network, rm3.route, rm3.ref, rm3.name, rm3.colour, rm3.ref_colour) AS route_3,
create_route_hstore(rm4.network, rm4.cycle_network, rm4.route, rm4.ref, rm4.name, rm4.colour, rm4.ref_colour) AS route_4,
create_route_hstore(rm5.network, rm5.cycle_network, rm5.route, rm5.ref, rm5.name, rm5.colour, rm5.ref_colour) AS route_5,
create_route_hstore(rm6.network, rm6.cycle_network, rm6.route, 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

Wyświetl plik

@ -12,26 +12,32 @@ CREATE OR REPLACE FUNCTION layer_transportation_name(bbox geometry, zoom_level i
ref text,
ref_length int,
network text,
route_1_type text,
route_1_network text,
route_1_ref text,
route_1_name text,
route_1_colour text,
route_2_type text,
route_2_network text,
route_2_ref text,
route_2_name text,
route_2_colour text,
route_3_type text,
route_3_network text,
route_3_ref text,
route_3_name text,
route_3_colour text,
route_4_type text,
route_4_network text,
route_4_ref text,
route_4_name text,
route_4_colour text,
route_5_type text,
route_5_network text,
route_5_ref text,
route_5_name text,
route_5_colour text,
route_6_type text,
route_6_network text,
route_6_ref text,
route_6_name text,
@ -58,31 +64,37 @@ SELECT geometry,
WHEN length(coalesce(ref, '')) > 0
THEN 'road'
END AS network,
route_1->'route' AS route_1_type,
route_1->'network' AS route_1_network,
route_1->'ref' AS route_1_ref,
route_1->'name' AS route_1_name,
route_1->'colour' AS route_1_colour,
route_2->'route' AS route_2_type,
route_2->'network' AS route_2_network,
route_2->'ref' AS route_2_ref,
route_2->'name' AS route_2_name,
route_2->'colour' AS route_2_colour,
route_3->'route' AS route_3_type,
route_3->'network' AS route_3_network,
route_3->'ref' AS route_3_ref,
route_3->'name' AS route_3_name,
route_3->'colour' AS route_3_colour,
route_4->'route' AS route_4_type,
route_4->'network' AS route_4_network,
route_4->'ref' AS route_4_ref,
route_4->'name' AS route_4_name,
route_4->'colour' AS route_4_colour,
route_5->'route' AS route_5_type,
route_5->'network' AS route_5_network,
route_5->'ref' AS route_5_ref,
route_5->'name' AS route_5_name,
route_5->'colour' AS route_5_colour,
route_6->'route' AS route_6_type,
route_6->'network' AS route_6_network,
route_6->'ref' AS route_6_ref,
route_6->'name' AS route_6_name,

Wyświetl plik

@ -101,26 +101,32 @@ layer:
value of [`indoor`](http://wiki.openstreetmap.org/wiki/Key:indoor) tag.
values:
- 1
route_1_type: 1st route concurrency type.
route_1_network: 1st route concurrency network.
route_1_ref: 1st route concurrency ref.
route_1_name: 1st route concurrency name.
route_1_colour: 1st route concurrency colour.
route_2_type: 2nd route concurrency type.
route_2_network: 2nd route concurrency network.
route_2_ref: 2nd route concurrency ref.
route_2_name: 2nd route concurrency name.
route_2_colour: 2nd route concurrency colour.
route_3_type: 3rd route concurrency type.
route_3_network: 3rd route concurrency network.
route_3_ref: 3rd route concurrency ref.
route_3_name: 3rd route concurrency name.
route_3_colour: 3rd route concurrency colour.
route_4_type: 4th route concurrency type.
route_4_network: 4th route concurrency network.
route_4_ref: 4th route concurrency ref.
route_4_name: 4th route concurrency name.
route_4_colour: 4th route concurrency colour.
route_5_type: 5th route concurrency type.
route_5_network: 5th route concurrency network.
route_5_ref: 5th route concurrency ref.
route_5_name: 5th route concurrency name.
route_5_colour: 5th route concurrency colour.
route_6_type: 6th route concurrency type.
route_6_network: 6th route concurrency network.
route_6_ref: 6th route concurrency ref.
route_6_name: 6th route concurrency name.
@ -128,7 +134,7 @@ layer:
datasource:
geometry_field: geometry
srid: 900913
query: (SELECT geometry, name, name_en, name_de, {name_languages}, ref, ref_length, network::text, class::text, subclass, brunnel, layer, level, indoor, route_1_network, route_1_ref, route_1_name, route_1_colour, route_2_network, route_2_ref, route_2_name, route_2_colour, route_3_network, route_3_ref, route_3_name, route_3_colour, route_4_network, route_4_ref, route_4_name, route_4_colour, route_5_network, route_5_ref, route_5_name, route_5_colour, route_6_network, route_6_ref, route_6_name, route_6_colour FROM layer_transportation_name(!bbox!, z(!scale_denominator!))) AS t
query: (SELECT geometry, name, name_en, name_de, {name_languages}, ref, ref_length, network::text, class::text, subclass, brunnel, layer, level, indoor, route_1_type, route_1_network, route_1_ref, route_1_name, route_1_colour, route_2_type, route_2_network, route_2_ref, route_2_name, route_2_colour, route_3_type, route_3_network, route_3_ref, route_3_name, route_3_colour, route_4_type, route_4_network, route_4_ref, route_4_name, route_4_colour, route_5_type, route_5_network, route_5_ref, route_5_name, route_5_colour, route_6_type, route_6_network, route_6_ref, route_6_name, route_6_colour FROM layer_transportation_name(!bbox!, z(!scale_denominator!))) AS t
schema:
- ./highway_classification.sql
- ./update_transportation_name.sql

Wyświetl plik

@ -763,13 +763,13 @@ BEGIN
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,
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,
create_route_hstore(rm1.network, rm1.cycle_network, rm1.route, rm1.ref, rm1.name, rm1.colour, rm1.ref_colour) AS route_1,
create_route_hstore(rm2.network, rm2.cycle_network, rm2.route, rm2.ref, rm2.name, rm2.colour, rm2.ref_colour) AS route_2,
create_route_hstore(rm3.network, rm3.cycle_network, rm3.route, rm3.ref, rm3.name, rm3.colour, rm3.ref_colour) AS route_3,
create_route_hstore(rm4.network, rm4.cycle_network, rm4.route, rm4.ref, rm4.name, rm4.colour, rm4.ref_colour) AS route_4,
create_route_hstore(rm5.network, rm5.cycle_network, rm5.route, rm5.ref, rm5.name, rm5.colour, rm5.ref_colour) AS route_5,
create_route_hstore(rm6.network, rm6.cycle_network, rm6.route, 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
JOIN transportation_name.network_changes AS c ON