Selective rendering of tracks and paths at z12-13 (#1190)
Closes #271 This PR adds track and path rendering at lower zooms than currently provided, and also achieves near-parity with openstreetmap-carto on track and path rendering. A previously-abandoned attempt, with significant discussion, was #1169.pull/1306/head^2
Przed Szerokość: | Wysokość: | Rozmiar: 556 KiB Po Szerokość: | Wysokość: | Rozmiar: 538 KiB |
|
@ -151,6 +151,10 @@ mtb_scale_field: &mtb_scale
|
|||
key: mtb:scale
|
||||
name: mtb_scale
|
||||
type: string
|
||||
sac_scale_field: &sac_scale
|
||||
key: sac_scale
|
||||
name: sac_scale
|
||||
type: string
|
||||
surface_field: &surface
|
||||
key: surface
|
||||
name: surface
|
||||
|
@ -200,6 +204,7 @@ tables:
|
|||
- *foot
|
||||
- *horse
|
||||
- *mtb_scale
|
||||
- *sac_scale
|
||||
- *surface
|
||||
mapping:
|
||||
highway:
|
||||
|
@ -425,6 +430,13 @@ tables:
|
|||
- *ref
|
||||
- *network
|
||||
- *name
|
||||
- name: osmc_symbol
|
||||
key: osmc:symbol
|
||||
type: string
|
||||
- name: colour
|
||||
key: colour
|
||||
type: string
|
||||
mapping:
|
||||
route:
|
||||
- road
|
||||
- hiking
|
||||
|
|
Przed Szerokość: | Wysokość: | Rozmiar: 128 KiB Po Szerokość: | Wysokość: | Rozmiar: 129 KiB |
|
@ -329,9 +329,12 @@ FROM (
|
|||
-- etldoc: osm_highway_linestring -> layer_transportation:z12
|
||||
-- etldoc: osm_highway_linestring -> layer_transportation:z13
|
||||
-- etldoc: osm_highway_linestring -> layer_transportation:z14_
|
||||
SELECT osm_id,
|
||||
geometry,
|
||||
highway,
|
||||
-- etldoc: osm_transportation_name_network -> layer_transportation:z12
|
||||
-- etldoc: osm_transportation_name_network -> layer_transportation:z13
|
||||
-- etldoc: osm_transportation_name_network -> layer_transportation:z14_
|
||||
SELECT hl.osm_id,
|
||||
hl.geometry,
|
||||
hl.highway,
|
||||
construction,
|
||||
network,
|
||||
NULL AS railway,
|
||||
|
@ -347,25 +350,34 @@ FROM (
|
|||
is_ramp,
|
||||
is_oneway,
|
||||
man_made,
|
||||
layer,
|
||||
CASE WHEN highway IN ('footway', 'steps') THEN "level" END AS "level",
|
||||
CASE WHEN highway IN ('footway', 'steps') THEN indoor END AS indoor,
|
||||
hl.layer,
|
||||
CASE WHEN hl.highway IN ('footway', 'steps') THEN hl.level END AS level,
|
||||
CASE WHEN hl.highway IN ('footway', 'steps') THEN hl.indoor END AS indoor,
|
||||
bicycle,
|
||||
foot,
|
||||
horse,
|
||||
mtb_scale,
|
||||
surface_value(surface) AS "surface",
|
||||
z_order
|
||||
FROM osm_highway_linestring
|
||||
hl.z_order
|
||||
FROM osm_highway_linestring hl
|
||||
LEFT OUTER JOIN osm_transportation_name_network n ON hl.osm_id = n.osm_id
|
||||
WHERE NOT is_area
|
||||
AND
|
||||
CASE WHEN zoom_level = 12 THEN transportation_filter_z12(highway, construction)
|
||||
CASE WHEN zoom_level = 12 THEN
|
||||
CASE WHEN transportation_filter_z12(hl.highway, hl.construction) THEN TRUE
|
||||
WHEN n.route_rank = 1 THEN TRUE
|
||||
END
|
||||
WHEN zoom_level = 13 THEN
|
||||
CASE WHEN man_made='pier' THEN NOT ST_IsClosed(geometry)
|
||||
ELSE transportation_filter_z13(highway, public_transport, construction, service)
|
||||
CASE WHEN man_made='pier' THEN NOT ST_IsClosed(hl.geometry)
|
||||
WHEN hl.highway = 'path' THEN (
|
||||
hl.name <> ''
|
||||
OR n.route_rank BETWEEN 1 AND 2
|
||||
OR hl.sac_scale <> ''
|
||||
)
|
||||
ELSE transportation_filter_z13(hl.highway, public_transport, hl.construction, service)
|
||||
END
|
||||
WHEN zoom_level >= 14 THEN
|
||||
CASE WHEN man_made='pier' THEN NOT ST_IsClosed(geometry)
|
||||
CASE WHEN man_made='pier' THEN NOT ST_IsClosed(hl.geometry)
|
||||
ELSE TRUE
|
||||
END
|
||||
END
|
||||
|
|
|
@ -60,17 +60,22 @@ BEGIN
|
|||
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)
|
||||
INSERT INTO osm_route_member (id, osm_id, network_type, concurrency_index, rank)
|
||||
SELECT
|
||||
id,
|
||||
osm_id,
|
||||
osm_route_member_network_type(network) AS network_type,
|
||||
DENSE_RANK() over (PARTITION BY member ORDER BY network_type, network, LENGTH(ref), ref) AS concurrency_index
|
||||
DENSE_RANK() over (PARTITION BY member ORDER BY network_type, network, LENGTH(ref), ref) AS concurrency_index,
|
||||
CASE
|
||||
WHEN network IN ('iwn', 'nwn', 'rwn') THEN 1
|
||||
WHEN network = 'lwn' THEN 2
|
||||
WHEN osmc_symbol || colour <> '' THEN 2
|
||||
END AS rank
|
||||
FROM osm_route_member rm
|
||||
WHERE rm.member IN
|
||||
(SELECT DISTINCT osm_id FROM transportation_name.network_changes)
|
||||
ON CONFLICT (id, osm_id) DO UPDATE SET concurrency_index = EXCLUDED.concurrency_index;
|
||||
|
||||
ON CONFLICT (id, osm_id) DO UPDATE SET concurrency_index = EXCLUDED.concurrency_index,
|
||||
rank = EXCLUDED.rank;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
|
@ -84,16 +89,22 @@ CREATE INDEX IF NOT EXISTS osm_route_member_network_type_idx ON osm_route_member
|
|||
CREATE INDEX IF NOT EXISTS osm_highway_linestring_osm_id_idx ON osm_highway_linestring ("osm_id");
|
||||
CREATE INDEX IF NOT EXISTS osm_highway_linestring_gen_z11_osm_id_idx ON osm_highway_linestring_gen_z11 ("osm_id");
|
||||
|
||||
ALTER TABLE osm_route_member ADD COLUMN IF NOT EXISTS concurrency_index int;
|
||||
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
|
||||
INSERT INTO osm_route_member (id, osm_id, concurrency_index)
|
||||
INSERT INTO osm_route_member (id, osm_id, concurrency_index, rank)
|
||||
SELECT
|
||||
id,
|
||||
osm_id,
|
||||
DENSE_RANK() over (PARTITION BY member ORDER BY network_type, network, LENGTH(ref), ref) AS concurrency_index
|
||||
DENSE_RANK() over (PARTITION BY member ORDER BY network_type, network, LENGTH(ref), ref) AS concurrency_index,
|
||||
CASE
|
||||
WHEN network IN ('iwn', 'nwn', 'rwn') THEN 1
|
||||
WHEN network = 'lwn' THEN 2
|
||||
WHEN osmc_symbol || colour <> '' THEN 2
|
||||
END AS rank
|
||||
FROM osm_route_member
|
||||
ON CONFLICT (id, osm_id) DO UPDATE SET concurrency_index = EXCLUDED.concurrency_index;
|
||||
ON CONFLICT (id, osm_id) DO UPDATE SET concurrency_index = EXCLUDED.concurrency_index, rank = EXCLUDED.rank;
|
||||
|
||||
UPDATE osm_highway_linestring hl
|
||||
SET network = rm.network_type
|
||||
|
|
|
@ -6,6 +6,70 @@ DROP TRIGGER IF EXISTS trigger_refresh ON transportation.updates;
|
|||
-- to allow for nice label rendering
|
||||
-- Because this works well for roads that do not have relations as well
|
||||
|
||||
-- etldoc: osm_highway_linestring -> osm_transportation_name_network
|
||||
-- etldoc: osm_route_member -> osm_transportation_name_network
|
||||
CREATE TABLE IF NOT EXISTS osm_transportation_name_network AS
|
||||
SELECT
|
||||
geometry,
|
||||
osm_id,
|
||||
name,
|
||||
name_en,
|
||||
name_de,
|
||||
tags,
|
||||
ref,
|
||||
highway,
|
||||
subclass,
|
||||
brunnel,
|
||||
"level",
|
||||
sac_scale,
|
||||
layer,
|
||||
indoor,
|
||||
network_type,
|
||||
route_1, route_2, route_3, route_4, route_5, route_6,
|
||||
z_order,
|
||||
route_rank
|
||||
FROM (
|
||||
SELECT DISTINCT ON (hl.osm_id)
|
||||
hl.geometry,
|
||||
hl.osm_id,
|
||||
CASE WHEN length(hl.name) > 15 THEN osml10n_street_abbrev_all(hl.name) ELSE NULLIF(hl.name, '') END AS "name",
|
||||
CASE WHEN length(hl.name_en) > 15 THEN osml10n_street_abbrev_en(hl.name_en) ELSE NULLIF(hl.name_en, '') END AS "name_en",
|
||||
CASE WHEN length(hl.name_de) > 15 THEN osml10n_street_abbrev_de(hl.name_de) ELSE NULLIF(hl.name_de, '') END AS "name_de",
|
||||
slice_language_tags(hl.tags) AS tags,
|
||||
rm1.network_type,
|
||||
CASE
|
||||
WHEN rm1.network_type IS NOT NULL AND rm1.ref::text <> ''
|
||||
THEN rm1.ref::text
|
||||
ELSE NULLIF(hl.ref, '')
|
||||
END AS ref,
|
||||
hl.highway,
|
||||
NULLIF(hl.construction, '') AS subclass,
|
||||
brunnel(hl.is_bridge, hl.is_tunnel, hl.is_ford) AS brunnel,
|
||||
sac_scale,
|
||||
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,
|
||||
hl.z_order,
|
||||
LEAST(rm1.rank, rm2.rank, rm3.rank, rm4.rank, rm5.rank, rm6.rank) AS route_rank
|
||||
FROM osm_highway_linestring hl
|
||||
LEFT OUTER JOIN osm_route_member rm1 ON rm1.member = hl.osm_id AND rm1.concurrency_index=1
|
||||
LEFT OUTER JOIN osm_route_member rm2 ON rm2.member = hl.osm_id AND rm2.concurrency_index=2
|
||||
LEFT OUTER JOIN osm_route_member rm3 ON rm3.member = hl.osm_id AND rm3.concurrency_index=3
|
||||
LEFT OUTER JOIN osm_route_member rm4 ON rm4.member = hl.osm_id AND rm4.concurrency_index=4
|
||||
LEFT OUTER JOIN osm_route_member rm5 ON rm5.member = hl.osm_id AND rm5.concurrency_index=5
|
||||
LEFT OUTER JOIN osm_route_member rm6 ON rm6.member = hl.osm_id AND rm6.concurrency_index=6
|
||||
WHERE (hl.name <> '' OR hl.ref <> '' OR rm1.ref <> '' OR rm1.network <> '')
|
||||
AND hl.highway <> ''
|
||||
) AS t;
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS osm_transportation_name_network_osm_id_idx ON osm_transportation_name_network (osm_id);
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_network_name_ref_idx ON osm_transportation_name_network (coalesce(name, ''), coalesce(ref, ''));
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_network_geometry_idx ON osm_transportation_name_network USING gist (geometry);
|
||||
|
||||
-- Improve performance of the sql in transportation/update_route_member.sql
|
||||
CREATE INDEX IF NOT EXISTS osm_highway_linestring_highway_partial_idx
|
||||
|
@ -29,6 +93,7 @@ SELECT (ST_Dump(ST_LineMerge(ST_Collect(geometry)))).geom AS geometry,
|
|||
foot,
|
||||
horse,
|
||||
mtb_scale,
|
||||
sac_scale,
|
||||
CASE
|
||||
WHEN access IN ('private', 'no') THEN 'no'
|
||||
ELSE NULL::text END AS access,
|
||||
|
@ -36,7 +101,7 @@ SELECT (ST_Dump(ST_LineMerge(ST_Collect(geometry)))).geom AS geometry,
|
|||
layer
|
||||
FROM osm_highway_linestring_gen_z11
|
||||
-- mapping.yaml pre-filter: motorway/trunk/primary/secondary/tertiary, with _link variants, construction, ST_IsValid()
|
||||
GROUP BY highway, network, construction, is_bridge, is_tunnel, is_ford, bicycle, foot, horse, mtb_scale, access, toll, layer
|
||||
GROUP BY highway, network, construction, is_bridge, is_tunnel, is_ford, bicycle, foot, horse, mtb_scale, sac_scale, access, toll, layer
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen_z11_geometry_idx
|
||||
ON osm_transportation_merge_linestring_gen_z11 USING gist (geometry);
|
||||
|
@ -57,6 +122,7 @@ SELECT ST_Simplify(geometry, ZRes(12)) AS geometry,
|
|||
foot,
|
||||
horse,
|
||||
mtb_scale,
|
||||
sac_scale,
|
||||
access,
|
||||
toll,
|
||||
layer
|
||||
|
@ -83,6 +149,7 @@ SELECT ST_Simplify(geometry, ZRes(11)) AS geometry,
|
|||
foot,
|
||||
horse,
|
||||
mtb_scale,
|
||||
sac_scale,
|
||||
access,
|
||||
toll,
|
||||
layer
|
||||
|
|
Przed Szerokość: | Wysokość: | Rozmiar: 286 KiB Po Szerokość: | Wysokość: | Rozmiar: 284 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 128 KiB Po Szerokość: | Wysokość: | Rozmiar: 129 KiB |
|
@ -110,8 +110,12 @@ FROM (
|
|||
FROM osm_transportation_name_linestring
|
||||
WHERE zoom_level = 12
|
||||
AND LineLabel(zoom_level, COALESCE(name, ref), geometry)
|
||||
AND (highway_class(highway, '', subclass) NOT IN ('minor', 'track', 'path') OR highway='shipway')
|
||||
AND NOT highway_is_link(highway)
|
||||
AND
|
||||
CASE WHEN highway_class(highway, NULL::text, NULL::text) NOT IN ('path', 'minor') THEN TRUE
|
||||
WHEN highway IN ('unclassified', 'residential', 'shipway') THEN TRUE
|
||||
WHEN route_rank = 1 THEN TRUE END
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_transportation_name_linestring -> layer_transportation_name:z13
|
||||
|
@ -133,7 +137,16 @@ FROM (
|
|||
FROM osm_transportation_name_linestring
|
||||
WHERE zoom_level = 13
|
||||
AND LineLabel(zoom_level, COALESCE(name, ref), geometry)
|
||||
AND (highway_class(highway, '', subclass) NOT IN ('track', 'path') OR highway='shipway')
|
||||
AND
|
||||
CASE WHEN highway <> 'path' THEN TRUE
|
||||
WHEN highway = 'path' AND (
|
||||
name <> ''
|
||||
OR network IS NOT NULL
|
||||
OR sac_scale <> ''
|
||||
OR route_rank <= 2
|
||||
) THEN TRUE
|
||||
END
|
||||
|
||||
UNION ALL
|
||||
|
||||
-- etldoc: osm_transportation_name_linestring -> layer_transportation_name:z14_
|
||||
|
|
|
@ -3,69 +3,6 @@
|
|||
-- to allow for nice label rendering
|
||||
-- Because this works well for roads that do not have relations as well
|
||||
|
||||
|
||||
-- etldoc: osm_highway_linestring -> osm_transportation_name_network
|
||||
-- etldoc: osm_route_member -> osm_transportation_name_network
|
||||
CREATE TABLE IF NOT EXISTS osm_transportation_name_network AS
|
||||
SELECT
|
||||
geometry,
|
||||
osm_id,
|
||||
name,
|
||||
name_en,
|
||||
name_de,
|
||||
tags,
|
||||
ref,
|
||||
highway,
|
||||
subclass,
|
||||
brunnel,
|
||||
"level",
|
||||
layer,
|
||||
indoor,
|
||||
network_type,
|
||||
route_1, route_2, route_3, route_4, route_5, route_6,
|
||||
z_order
|
||||
FROM (
|
||||
SELECT DISTINCT ON (hl.osm_id)
|
||||
hl.geometry,
|
||||
hl.osm_id,
|
||||
CASE WHEN length(hl.name) > 15 THEN osml10n_street_abbrev_all(hl.name) ELSE NULLIF(hl.name, '') END AS "name",
|
||||
CASE WHEN length(hl.name_en) > 15 THEN osml10n_street_abbrev_en(hl.name_en) ELSE NULLIF(hl.name_en, '') END AS "name_en",
|
||||
CASE WHEN length(hl.name_de) > 15 THEN osml10n_street_abbrev_de(hl.name_de) ELSE NULLIF(hl.name_de, '') END AS "name_de",
|
||||
slice_language_tags(hl.tags) AS tags,
|
||||
rm1.network_type,
|
||||
CASE
|
||||
WHEN rm1.network_type IS NOT NULL AND rm1.ref::text <> ''
|
||||
THEN rm1.ref::text
|
||||
ELSE NULLIF(hl.ref, '')
|
||||
END AS ref,
|
||||
hl.highway,
|
||||
NULLIF(hl.construction, '') AS subclass,
|
||||
brunnel(hl.is_bridge, hl.is_tunnel, hl.is_ford) AS brunnel,
|
||||
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,
|
||||
hl.z_order
|
||||
FROM osm_highway_linestring hl
|
||||
LEFT OUTER JOIN osm_route_member rm1 ON rm1.member = hl.osm_id AND rm1.concurrency_index=1
|
||||
LEFT OUTER JOIN osm_route_member rm2 ON rm2.member = hl.osm_id AND rm2.concurrency_index=2
|
||||
LEFT OUTER JOIN osm_route_member rm3 ON rm3.member = hl.osm_id AND rm3.concurrency_index=3
|
||||
LEFT OUTER JOIN osm_route_member rm4 ON rm4.member = hl.osm_id AND rm4.concurrency_index=4
|
||||
LEFT OUTER JOIN osm_route_member rm5 ON rm5.member = hl.osm_id AND rm5.concurrency_index=5
|
||||
LEFT OUTER JOIN osm_route_member rm6 ON rm6.member = hl.osm_id AND rm6.concurrency_index=6
|
||||
WHERE (hl.name <> '' OR hl.ref <> '' OR rm1.ref <> '' OR rm1.network <> '')
|
||||
AND hl.highway <> ''
|
||||
) AS t;
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_network_osm_id_idx ON osm_transportation_name_network (osm_id);
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_network_name_ref_idx ON osm_transportation_name_network (coalesce(name, ''), coalesce(ref, ''));
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_network_geometry_idx ON osm_transportation_name_network USING gist (geometry);
|
||||
|
||||
|
||||
-- etldoc: osm_transportation_name_network -> osm_transportation_name_linestring
|
||||
-- etldoc: osm_shipway_linestring -> osm_transportation_name_linestring
|
||||
CREATE TABLE IF NOT EXISTS osm_transportation_name_linestring AS
|
||||
|
@ -78,12 +15,14 @@ SELECT (ST_Dump(geometry)).geom AS geometry,
|
|||
highway,
|
||||
subclass,
|
||||
brunnel,
|
||||
sac_scale,
|
||||
"level",
|
||||
layer,
|
||||
indoor,
|
||||
network_type AS network,
|
||||
route_1, route_2, route_3, route_4, route_5, route_6,
|
||||
z_order
|
||||
z_order,
|
||||
route_rank
|
||||
FROM (
|
||||
SELECT ST_LineMerge(ST_Collect(geometry)) AS geometry,
|
||||
name,
|
||||
|
@ -97,15 +36,17 @@ FROM (
|
|||
CASE WHEN COUNT(*) = COUNT(brunnel) AND MAX(brunnel) = MIN(brunnel)
|
||||
THEN MAX(brunnel)
|
||||
ELSE NULL::text END AS brunnel,
|
||||
sac_scale,
|
||||
"level",
|
||||
layer,
|
||||
indoor,
|
||||
network_type,
|
||||
route_1, route_2, route_3, route_4, route_5, route_6,
|
||||
min(z_order) AS z_order
|
||||
min(z_order) AS z_order,
|
||||
min(route_rank) AS route_rank
|
||||
FROM osm_transportation_name_network
|
||||
WHERE name <> '' OR ref <> ''
|
||||
GROUP BY name, name_en, name_de, tags, ref, highway, subclass, "level", layer, indoor, network_type,
|
||||
GROUP BY name, name_en, name_de, tags, ref, highway, subclass, sac_scale, "level", layer, indoor, network_type,
|
||||
route_1, route_2, route_3, route_4, route_5, route_6
|
||||
UNION ALL
|
||||
|
||||
|
@ -118,6 +59,7 @@ FROM (
|
|||
'shipway' AS highway,
|
||||
shipway AS subclass,
|
||||
NULL AS brunnel,
|
||||
NULL AS sac_scale,
|
||||
NULL::int AS level,
|
||||
layer,
|
||||
NULL AS indoor,
|
||||
|
@ -128,7 +70,8 @@ FROM (
|
|||
NULL AS route_4,
|
||||
NULL AS route_5,
|
||||
NULL AS route_6,
|
||||
min(z_order) AS z_order
|
||||
min(z_order) AS z_order,
|
||||
NULL::int AS route_rank
|
||||
FROM osm_shipway_linestring
|
||||
WHERE name <> ''
|
||||
GROUP BY name, name_en, name_de, tags, subclass, "level", layer
|
||||
|
@ -341,11 +284,13 @@ BEGIN
|
|||
subclass,
|
||||
brunnel,
|
||||
level,
|
||||
sac_scale,
|
||||
layer,
|
||||
indoor,
|
||||
network_type,
|
||||
route_1, route_2, route_3, route_4, route_5, route_6,
|
||||
z_order
|
||||
z_order,
|
||||
route_rank
|
||||
FROM (
|
||||
SELECT hl.geometry,
|
||||
hl.osm_id,
|
||||
|
@ -362,6 +307,7 @@ BEGIN
|
|||
hl.highway,
|
||||
NULLIF(hl.construction, '') AS subclass,
|
||||
brunnel(hl.is_bridge, hl.is_tunnel, hl.is_ford) AS brunnel,
|
||||
sac_scale,
|
||||
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,
|
||||
|
@ -371,7 +317,8 @@ BEGIN
|
|||
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,
|
||||
hl.z_order
|
||||
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
|
||||
hl.osm_id = c.osm_id
|
||||
|
@ -383,7 +330,8 @@ BEGIN
|
|||
LEFT OUTER JOIN osm_route_member rm6 ON rm6.member = hl.osm_id AND rm6.concurrency_index=6
|
||||
WHERE (hl.name <> '' OR hl.ref <> '' OR rm1.ref <> '' OR rm1.network <> '')
|
||||
AND hl.highway <> ''
|
||||
) AS t;
|
||||
) AS t
|
||||
ON CONFLICT DO NOTHING;
|
||||
|
||||
-- noinspection SqlWithoutWhere
|
||||
DELETE FROM transportation_name.network_changes;
|
||||
|
@ -436,6 +384,7 @@ CREATE TABLE IF NOT EXISTS transportation_name.name_changes
|
|||
highway character varying,
|
||||
subclass character varying,
|
||||
brunnel character varying,
|
||||
sac_scale character varying,
|
||||
level integer,
|
||||
layer integer,
|
||||
indoor boolean,
|
||||
|
@ -498,7 +447,7 @@ BEGIN
|
|||
|
||||
-- Compact the change history to keep only the first and last version, and then uniq version of row
|
||||
CREATE TEMP TABLE name_changes_compact AS
|
||||
SELECT DISTINCT ON (name, name_en, name_de, tags, ref, highway, subclass, brunnel, level, layer, indoor, network_type,
|
||||
SELECT DISTINCT ON (name, name_en, name_de, tags, ref, highway, subclass, brunnel, sac_scale, level, layer, indoor, network_type,
|
||||
route_1, route_2, route_3, route_4, route_5, route_6)
|
||||
name,
|
||||
name_en,
|
||||
|
@ -508,6 +457,7 @@ BEGIN
|
|||
highway,
|
||||
subclass,
|
||||
brunnel,
|
||||
sac_scale,
|
||||
level,
|
||||
layer,
|
||||
indoor,
|
||||
|
@ -541,6 +491,7 @@ BEGIN
|
|||
AND n.highway IS NOT DISTINCT FROM c.highway
|
||||
AND n.subclass IS NOT DISTINCT FROM c.subclass
|
||||
AND n.brunnel IS NOT DISTINCT FROM c.brunnel
|
||||
AND n.sac_scale IS NOT DISTINCT FROM c.sac_scale
|
||||
AND n.level IS NOT DISTINCT FROM c.level
|
||||
AND n.layer IS NOT DISTINCT FROM c.layer
|
||||
AND n.indoor IS NOT DISTINCT FROM c.indoor
|
||||
|
@ -562,6 +513,7 @@ BEGIN
|
|||
highway,
|
||||
subclass,
|
||||
brunnel,
|
||||
sac_scale,
|
||||
level,
|
||||
layer,
|
||||
indoor,
|
||||
|
@ -580,6 +532,7 @@ BEGIN
|
|||
n.highway,
|
||||
n.subclass,
|
||||
n.brunnel,
|
||||
n.sac_scale,
|
||||
n.level,
|
||||
n.layer,
|
||||
n.indoor,
|
||||
|
@ -596,6 +549,7 @@ BEGIN
|
|||
AND n.highway IS NOT DISTINCT FROM c.highway
|
||||
AND n.subclass IS NOT DISTINCT FROM c.subclass
|
||||
AND n.brunnel IS NOT DISTINCT FROM c.brunnel
|
||||
AND n.sac_scale IS NOT DISTINCT FROM c.sac_scale
|
||||
AND n.level IS NOT DISTINCT FROM c.level
|
||||
AND n.layer IS NOT DISTINCT FROM c.layer
|
||||
AND n.indoor IS NOT DISTINCT FROM c.indoor
|
||||
|
@ -606,7 +560,7 @@ BEGIN
|
|||
AND n.route_4 IS NOT DISTINCT FROM c.route_4
|
||||
AND n.route_5 IS NOT DISTINCT FROM c.route_5
|
||||
AND n.route_6 IS NOT DISTINCT FROM c.route_6
|
||||
GROUP BY n.name, n.name_en, n.name_de, n.tags, n.ref, n.highway, n.subclass, n.brunnel, n.level, n.layer, n.indoor, n.network_type,
|
||||
GROUP BY n.name, n.name_en, n.name_de, n.tags, n.ref, n.highway, n.subclass, n.brunnel, n.sac_scale, n.level, n.layer, n.indoor, n.network_type,
|
||||
n.route_1, n.route_2, n.route_3, n.route_4, n.route_5, n.route_6
|
||||
) AS highway_union;
|
||||
|
||||
|
|
|
@ -14,6 +14,10 @@
|
|||
<node id="500052" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="33.5" lon="-90.05" />
|
||||
<node id="500061" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="33.0" lon="-90.06" />
|
||||
<node id="500062" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="33.5" lon="-90.06" />
|
||||
<node id="500071" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="33.0" lon="-90.07" />
|
||||
<node id="500072" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="33.5" lon="-90.07" />
|
||||
<node id="500081" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="33.0" lon="-90.07" />
|
||||
<node id="500082" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" lat="33.5" lon="-90.07" />
|
||||
|
||||
<way id="5000" version="1" timestamp="2019-01-01T00:00:00Z" visible="true">
|
||||
<nd ref="500001" />
|
||||
|
@ -65,4 +69,29 @@
|
|||
<tag k="highway" v="track"/>
|
||||
<tag k="name" v="OpenMapTiles Track"/>
|
||||
</way>
|
||||
<way id="5007" version="1" timestamp="2019-01-01T00:00:00Z" visible="true">
|
||||
<nd ref="500071" />
|
||||
<nd ref="500072" />
|
||||
<tag k="highway" v="path"/>
|
||||
<tag k="name" v="OpenMapTiles Path z13"/>
|
||||
</way>
|
||||
<way id="5008" version="1" timestamp="2019-01-01T00:00:00Z" visible="true">
|
||||
<nd ref="500081" />
|
||||
<nd ref="500082" />
|
||||
<tag k="highway" v="path"/>
|
||||
<tag k="name" v="OpenMapTiles Track z12"/>
|
||||
</way>
|
||||
|
||||
<relation id="507" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" changeset="1" user="u" uid="1">
|
||||
<member type="way" ref="5007" role=""/>
|
||||
<tag k="type" v="route"/>
|
||||
<tag k="route" v="hiking"/>
|
||||
<tag k="colour" v="red"/>
|
||||
</relation>
|
||||
<relation id="508" visible="true" timestamp="2019-01-01T00:00:00Z" version="1" changeset="1" user="u" uid="1">
|
||||
<member type="way" ref="5008" role=""/>
|
||||
<tag k="type" v="route"/>
|
||||
<tag k="route" v="hiking"/>
|
||||
<tag k="network" v="nwn"/>
|
||||
</relation>
|
||||
</osm>
|
||||
|
|
|
@ -133,6 +133,20 @@ BEGIN
|
|||
INSERT INTO omt_test_failures VALUES(500, 'import', 'osm_transportation_linestring z9 import tags expected 1, got ' || cnt);
|
||||
END IF;
|
||||
|
||||
SELECT COUNT(*) INTO cnt FROM osm_transportation_name_linestring
|
||||
WHERE tags->'name' = 'OpenMapTiles Path z13'
|
||||
AND route_rank = 2;
|
||||
IF cnt <> 1 THEN
|
||||
INSERT INTO omt_test_failures VALUES(500, 'import', 'osm_transportation_name_linestring z13 route_rank expected 1, got ' || cnt);
|
||||
END IF;
|
||||
|
||||
SELECT COUNT(*) INTO cnt FROM osm_transportation_name_linestring
|
||||
WHERE tags->'name' = 'OpenMapTiles Track z12'
|
||||
AND route_rank = 1;
|
||||
IF cnt <> 1 THEN
|
||||
INSERT INTO omt_test_failures VALUES(500, 'import', 'osm_transportation_name_linestring z12 route_rank expected 1, got ' || cnt);
|
||||
END IF;
|
||||
|
||||
END;
|
||||
|
||||
$$
|
||||
|
|