Add new layer to serve highway=motorway_junction nodes (#1119)
This PR adds a layer for `highway=motorway_junction` features. This implementation of highway exits in the transportation_name layer add to the existing layer table structure, and renames the internal column name from "construction" (which was already overloaded with non-construction usages) to "subclass", which will be less confusing to future developers. The string 'junction' is used as the universal sub-class for highway exits. A new documentation PR has been opened at openmaptiles/www.openmaptiles.org#69 to reflect these changes in the documentation.pull/1085/head
Przed Szerokość: | Wysokość: | Rozmiar: 470 KiB Po Szerokość: | Wysokość: | Rozmiar: 552 KiB |
|
@ -367,6 +367,33 @@ tables:
|
||||||
- bridge
|
- bridge
|
||||||
- pier
|
- pier
|
||||||
|
|
||||||
|
# etldoc: imposm3 -> highway_point
|
||||||
|
highway_point:
|
||||||
|
type: point
|
||||||
|
columns:
|
||||||
|
- name: osm_id
|
||||||
|
type: id
|
||||||
|
- name: geometry
|
||||||
|
type: geometry
|
||||||
|
- name: highway
|
||||||
|
key: highway
|
||||||
|
type: string
|
||||||
|
- name: z_order
|
||||||
|
type: wayzorder
|
||||||
|
- *layer
|
||||||
|
- *level
|
||||||
|
- *name
|
||||||
|
- *name_en
|
||||||
|
- *name_de
|
||||||
|
- name: tags
|
||||||
|
type: hstore_tags
|
||||||
|
- name: ref
|
||||||
|
key: ref
|
||||||
|
type: string
|
||||||
|
mapping:
|
||||||
|
highway:
|
||||||
|
- motorway_junction
|
||||||
|
|
||||||
# TODO: Future table for joining networks
|
# TODO: Future table for joining networks
|
||||||
# etldoc: imposm3 -> osm_route_member
|
# etldoc: imposm3 -> osm_route_member
|
||||||
route_member:
|
route_member:
|
||||||
|
|
Przed Szerokość: | Wysokość: | Rozmiar: 134 KiB Po Szerokość: | Wysokość: | Rozmiar: 118 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 217 KiB Po Szerokość: | Wysokość: | Rozmiar: 232 KiB |
|
@ -0,0 +1,57 @@
|
||||||
|
CREATE OR REPLACE FUNCTION highway_to_val(hwy_class varchar)
|
||||||
|
RETURNS int
|
||||||
|
IMMUTABLE
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
AS $$
|
||||||
|
BEGIN
|
||||||
|
CASE hwy_class
|
||||||
|
WHEN 'motorway' THEN RETURN 6;
|
||||||
|
WHEN 'trunk' THEN RETURN 5;
|
||||||
|
WHEN 'primary' THEN RETURN 4;
|
||||||
|
WHEN 'secondary' THEN RETURN 3;
|
||||||
|
WHEN 'tertiary' THEN RETURN 2;
|
||||||
|
WHEN 'unclassified' THEN RETURN 1;
|
||||||
|
else RETURN 0;
|
||||||
|
END CASE;
|
||||||
|
END;
|
||||||
|
$$;
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION val_to_highway(hwy_val int)
|
||||||
|
RETURNS varchar
|
||||||
|
IMMUTABLE
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
AS $$
|
||||||
|
BEGIN
|
||||||
|
CASE hwy_val
|
||||||
|
WHEN 6 THEN RETURN 'motorway';
|
||||||
|
WHEN 5 THEN RETURN 'trunk';
|
||||||
|
WHEN 4 THEN RETURN 'primary';
|
||||||
|
WHEN 3 THEN RETURN 'secondary';
|
||||||
|
WHEN 2 THEN RETURN 'tertiary';
|
||||||
|
WHEN 1 THEN RETURN 'unclassified';
|
||||||
|
else RETURN null;
|
||||||
|
END CASE;
|
||||||
|
END;
|
||||||
|
$$;
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION highest_hwy_sfunc(agg_state varchar, hwy_class varchar)
|
||||||
|
RETURNS varchar
|
||||||
|
IMMUTABLE
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
AS $$
|
||||||
|
BEGIN
|
||||||
|
RETURN val_to_highway(
|
||||||
|
GREATEST(
|
||||||
|
highway_to_val(agg_state),
|
||||||
|
highway_to_val(hwy_class)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
END;
|
||||||
|
$$;
|
||||||
|
|
||||||
|
DROP AGGREGATE IF EXISTS highest_highway (varchar);
|
||||||
|
CREATE AGGREGATE highest_highway (varchar)
|
||||||
|
(
|
||||||
|
sfunc = highest_hwy_sfunc,
|
||||||
|
stype = varchar
|
||||||
|
);
|
Przed Szerokość: | Wysokość: | Rozmiar: 134 KiB Po Szerokość: | Wysokość: | Rozmiar: 118 KiB |
|
@ -37,10 +37,11 @@ SELECT osm_id,
|
||||||
WHEN length(coalesce(ref, '')) > 0
|
WHEN length(coalesce(ref, '')) > 0
|
||||||
THEN 'road'
|
THEN 'road'
|
||||||
END AS network,
|
END AS network,
|
||||||
highway_class(highway, '', construction) AS class,
|
highway_class(highway, '', subclass) AS class,
|
||||||
CASE
|
CASE
|
||||||
WHEN highway IS NOT NULL AND highway_class(highway, '', construction) = 'path'
|
WHEN highway IS NOT NULL AND highway_class(highway, '', subclass) = 'path'
|
||||||
THEN highway
|
THEN highway
|
||||||
|
ELSE subclass
|
||||||
END AS subclass,
|
END AS subclass,
|
||||||
brunnel,
|
brunnel,
|
||||||
NULLIF(layer, 0) AS layer,
|
NULLIF(layer, 0) AS layer,
|
||||||
|
@ -95,7 +96,7 @@ FROM (
|
||||||
"tags",
|
"tags",
|
||||||
ref,
|
ref,
|
||||||
highway,
|
highway,
|
||||||
construction,
|
subclass,
|
||||||
brunnel,
|
brunnel,
|
||||||
network,
|
network,
|
||||||
z_order,
|
z_order,
|
||||||
|
@ -105,7 +106,7 @@ FROM (
|
||||||
FROM osm_transportation_name_linestring
|
FROM osm_transportation_name_linestring
|
||||||
WHERE zoom_level = 12
|
WHERE zoom_level = 12
|
||||||
AND LineLabel(zoom_level, COALESCE(name, ref), geometry)
|
AND LineLabel(zoom_level, COALESCE(name, ref), geometry)
|
||||||
AND highway_class(highway, '', construction) NOT IN ('minor', 'track', 'path')
|
AND highway_class(highway, '', subclass) NOT IN ('minor', 'track', 'path')
|
||||||
AND NOT highway_is_link(highway)
|
AND NOT highway_is_link(highway)
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
|
@ -118,7 +119,7 @@ FROM (
|
||||||
"tags",
|
"tags",
|
||||||
ref,
|
ref,
|
||||||
highway,
|
highway,
|
||||||
construction,
|
subclass,
|
||||||
brunnel,
|
brunnel,
|
||||||
network,
|
network,
|
||||||
z_order,
|
z_order,
|
||||||
|
@ -128,7 +129,7 @@ FROM (
|
||||||
FROM osm_transportation_name_linestring
|
FROM osm_transportation_name_linestring
|
||||||
WHERE zoom_level = 13
|
WHERE zoom_level = 13
|
||||||
AND LineLabel(zoom_level, COALESCE(name, ref), geometry)
|
AND LineLabel(zoom_level, COALESCE(name, ref), geometry)
|
||||||
AND highway_class(highway, '', construction) NOT IN ('track', 'path')
|
AND highway_class(highway, '', subclass) NOT IN ('track', 'path')
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
-- etldoc: osm_transportation_name_linestring -> layer_transportation_name:z14_
|
-- etldoc: osm_transportation_name_linestring -> layer_transportation_name:z14_
|
||||||
|
@ -140,7 +141,7 @@ FROM (
|
||||||
"tags",
|
"tags",
|
||||||
ref,
|
ref,
|
||||||
highway,
|
highway,
|
||||||
construction,
|
subclass,
|
||||||
brunnel,
|
brunnel,
|
||||||
network,
|
network,
|
||||||
z_order,
|
z_order,
|
||||||
|
@ -149,6 +150,32 @@ FROM (
|
||||||
indoor
|
indoor
|
||||||
FROM osm_transportation_name_linestring
|
FROM osm_transportation_name_linestring
|
||||||
WHERE zoom_level >= 14
|
WHERE zoom_level >= 14
|
||||||
|
UNION ALL
|
||||||
|
|
||||||
|
-- etldoc: osm_highway_point -> layer_transportation_name:z10
|
||||||
|
SELECT
|
||||||
|
p.geometry,
|
||||||
|
p.osm_id,
|
||||||
|
p.name,
|
||||||
|
p.name_en,
|
||||||
|
p.name_de,
|
||||||
|
p.tags,
|
||||||
|
p.tags->'ref',
|
||||||
|
(
|
||||||
|
SELECT highest_highway(l.tags->'highway')
|
||||||
|
FROM osm_highway_linestring l
|
||||||
|
WHERE ST_Intersects(p.geometry,l.geometry)
|
||||||
|
) AS class,
|
||||||
|
'junction'::text AS subclass,
|
||||||
|
NULL AS brunnel,
|
||||||
|
NULL AS network,
|
||||||
|
z_order,
|
||||||
|
layer,
|
||||||
|
NULL::int AS level,
|
||||||
|
NULL::boolean AS indoor
|
||||||
|
FROM osm_highway_point p
|
||||||
|
WHERE highway = 'motorway_junction' AND zoom_level >= 10
|
||||||
|
|
||||||
) AS zoom_levels
|
) AS zoom_levels
|
||||||
WHERE geometry && bbox
|
WHERE geometry && bbox
|
||||||
ORDER BY z_order ASC;
|
ORDER BY z_order ASC;
|
||||||
|
|
|
@ -55,11 +55,13 @@ layer:
|
||||||
- raceway_construction
|
- raceway_construction
|
||||||
- rail
|
- rail
|
||||||
- transit
|
- transit
|
||||||
|
- motorway_junction
|
||||||
subclass:
|
subclass:
|
||||||
description: |
|
description: |
|
||||||
Distinguish more specific classes of path:
|
Distinguish more specific classes of path:
|
||||||
Subclass is value of the
|
Subclass is value of the
|
||||||
[`highway`](http://wiki.openstreetmap.org/wiki/Key:highway) (for paths).
|
[`highway`](http://wiki.openstreetmap.org/wiki/Key:highway) (for paths),
|
||||||
|
and "junction" for [`motorway junctions`](http://wiki.openstreetmap.org/wiki/Tag:highway=motorway_junction).
|
||||||
values:
|
values:
|
||||||
- pedestrian
|
- pedestrian
|
||||||
- path
|
- path
|
||||||
|
@ -69,6 +71,7 @@ layer:
|
||||||
- bridleway
|
- bridleway
|
||||||
- corridor
|
- corridor
|
||||||
- platform
|
- platform
|
||||||
|
- junction
|
||||||
brunnel:
|
brunnel:
|
||||||
description: |
|
description: |
|
||||||
Mark whether way is a bridge, a tunnel or a ford.
|
Mark whether way is a bridge, a tunnel or a ford.
|
||||||
|
@ -96,6 +99,7 @@ layer:
|
||||||
query: (SELECT geometry, name, name_en, name_de, {name_languages}, ref, ref_length, network::text, class::text, subclass, brunnel, layer, level, indoor 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 FROM layer_transportation_name(!bbox!, z(!scale_denominator!))) AS t
|
||||||
schema:
|
schema:
|
||||||
- ./network_type.sql
|
- ./network_type.sql
|
||||||
|
- ./highway_classification.sql
|
||||||
- ./update_route_member.sql
|
- ./update_route_member.sql
|
||||||
- ./update_transportation_name.sql
|
- ./update_transportation_name.sql
|
||||||
- ./transportation_name.sql
|
- ./transportation_name.sql
|
||||||
|
|
|
@ -16,7 +16,7 @@ SELECT
|
||||||
tags,
|
tags,
|
||||||
ref,
|
ref,
|
||||||
highway,
|
highway,
|
||||||
construction,
|
subclass,
|
||||||
brunnel,
|
brunnel,
|
||||||
"level",
|
"level",
|
||||||
layer,
|
layer,
|
||||||
|
@ -37,7 +37,7 @@ FROM (
|
||||||
ELSE NULLIF(hl.ref, '')
|
ELSE NULLIF(hl.ref, '')
|
||||||
END AS ref,
|
END AS ref,
|
||||||
hl.highway,
|
hl.highway,
|
||||||
hl.construction,
|
hl.construction AS subclass,
|
||||||
brunnel(hl.is_bridge, hl.is_tunnel, hl.is_ford) AS brunnel,
|
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 layer END AS layer,
|
||||||
CASE WHEN highway IN ('footway', 'steps') THEN level END AS level,
|
CASE WHEN highway IN ('footway', 'steps') THEN level END AS level,
|
||||||
|
@ -67,7 +67,7 @@ SELECT (ST_Dump(geometry)).geom AS geometry,
|
||||||
tags || get_basic_names(tags, geometry) AS "tags",
|
tags || get_basic_names(tags, geometry) AS "tags",
|
||||||
ref,
|
ref,
|
||||||
highway,
|
highway,
|
||||||
construction,
|
subclass,
|
||||||
brunnel,
|
brunnel,
|
||||||
"level",
|
"level",
|
||||||
layer,
|
layer,
|
||||||
|
@ -83,7 +83,7 @@ FROM (
|
||||||
ARRAY ['name', name, 'name:en', name_en, 'name:de', name_de]) AS tags,
|
ARRAY ['name', name, 'name:en', name_en, 'name:de', name_de]) AS tags,
|
||||||
ref,
|
ref,
|
||||||
highway,
|
highway,
|
||||||
construction,
|
subclass,
|
||||||
brunnel,
|
brunnel,
|
||||||
"level",
|
"level",
|
||||||
layer,
|
layer,
|
||||||
|
@ -91,14 +91,14 @@ FROM (
|
||||||
network_type,
|
network_type,
|
||||||
min(z_order) AS z_order
|
min(z_order) AS z_order
|
||||||
FROM osm_transportation_name_network
|
FROM osm_transportation_name_network
|
||||||
GROUP BY name, name_en, name_de, tags, ref, highway, construction, brunnel, "level", layer, indoor, network_type
|
GROUP BY name, name_en, name_de, tags, ref, highway, subclass, brunnel, "level", layer, indoor, network_type
|
||||||
) AS highway_union
|
) AS highway_union
|
||||||
;
|
;
|
||||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_name_ref_idx ON osm_transportation_name_linestring (coalesce(name, ''), coalesce(ref, ''));
|
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_name_ref_idx ON osm_transportation_name_linestring (coalesce(name, ''), coalesce(ref, ''));
|
||||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_geometry_idx ON osm_transportation_name_linestring USING gist (geometry);
|
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_geometry_idx ON osm_transportation_name_linestring USING gist (geometry);
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_highway_partial_idx
|
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_highway_partial_idx
|
||||||
ON osm_transportation_name_linestring (highway, construction)
|
ON osm_transportation_name_linestring (highway, subclass)
|
||||||
WHERE highway IN ('motorway', 'trunk', 'construction');
|
WHERE highway IN ('motorway', 'trunk', 'construction');
|
||||||
|
|
||||||
-- etldoc: osm_transportation_name_linestring -> osm_transportation_name_linestring_gen1
|
-- etldoc: osm_transportation_name_linestring -> osm_transportation_name_linestring_gen1
|
||||||
|
@ -111,12 +111,12 @@ SELECT ST_Simplify(geometry, 50) AS geometry,
|
||||||
tags,
|
tags,
|
||||||
ref,
|
ref,
|
||||||
highway,
|
highway,
|
||||||
construction,
|
subclass,
|
||||||
brunnel,
|
brunnel,
|
||||||
network,
|
network,
|
||||||
z_order
|
z_order
|
||||||
FROM osm_transportation_name_linestring
|
FROM osm_transportation_name_linestring
|
||||||
WHERE (highway IN ('motorway', 'trunk') OR highway = 'construction' AND construction IN ('motorway', 'trunk'))
|
WHERE (highway IN ('motorway', 'trunk') OR highway = 'construction' AND subclass IN ('motorway', 'trunk'))
|
||||||
AND ST_Length(geometry) > 8000
|
AND ST_Length(geometry) > 8000
|
||||||
;
|
;
|
||||||
CREATE TABLE IF NOT EXISTS osm_transportation_name_linestring_gen1 AS
|
CREATE TABLE IF NOT EXISTS osm_transportation_name_linestring_gen1 AS
|
||||||
|
@ -126,7 +126,7 @@ CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen1_name_ref_idx
|
||||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen1_geometry_idx ON osm_transportation_name_linestring_gen1 USING gist (geometry);
|
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen1_geometry_idx ON osm_transportation_name_linestring_gen1 USING gist (geometry);
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen1_highway_partial_idx
|
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen1_highway_partial_idx
|
||||||
ON osm_transportation_name_linestring_gen1 (highway, construction)
|
ON osm_transportation_name_linestring_gen1 (highway, subclass)
|
||||||
WHERE highway IN ('motorway', 'trunk', 'construction');
|
WHERE highway IN ('motorway', 'trunk', 'construction');
|
||||||
|
|
||||||
-- etldoc: osm_transportation_name_linestring_gen1 -> osm_transportation_name_linestring_gen2
|
-- etldoc: osm_transportation_name_linestring_gen1 -> osm_transportation_name_linestring_gen2
|
||||||
|
@ -139,12 +139,12 @@ SELECT ST_Simplify(geometry, 120) AS geometry,
|
||||||
tags,
|
tags,
|
||||||
ref,
|
ref,
|
||||||
highway,
|
highway,
|
||||||
construction,
|
subclass,
|
||||||
brunnel,
|
brunnel,
|
||||||
network,
|
network,
|
||||||
z_order
|
z_order
|
||||||
FROM osm_transportation_name_linestring_gen1
|
FROM osm_transportation_name_linestring_gen1
|
||||||
WHERE (highway IN ('motorway', 'trunk') OR highway = 'construction' AND construction IN ('motorway', 'trunk'))
|
WHERE (highway IN ('motorway', 'trunk') OR highway = 'construction' AND subclass IN ('motorway', 'trunk'))
|
||||||
AND ST_Length(geometry) > 14000
|
AND ST_Length(geometry) > 14000
|
||||||
;
|
;
|
||||||
CREATE TABLE IF NOT EXISTS osm_transportation_name_linestring_gen2 AS
|
CREATE TABLE IF NOT EXISTS osm_transportation_name_linestring_gen2 AS
|
||||||
|
@ -154,7 +154,7 @@ CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen2_name_ref_idx
|
||||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen2_geometry_idx ON osm_transportation_name_linestring_gen2 USING gist (geometry);
|
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen2_geometry_idx ON osm_transportation_name_linestring_gen2 USING gist (geometry);
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen2_highway_partial_idx
|
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen2_highway_partial_idx
|
||||||
ON osm_transportation_name_linestring_gen2 (highway, construction)
|
ON osm_transportation_name_linestring_gen2 (highway, subclass)
|
||||||
WHERE highway IN ('motorway', 'trunk', 'construction');
|
WHERE highway IN ('motorway', 'trunk', 'construction');
|
||||||
|
|
||||||
-- etldoc: osm_transportation_name_linestring_gen2 -> osm_transportation_name_linestring_gen3
|
-- etldoc: osm_transportation_name_linestring_gen2 -> osm_transportation_name_linestring_gen3
|
||||||
|
@ -167,12 +167,12 @@ SELECT ST_Simplify(geometry, 200) AS geometry,
|
||||||
tags,
|
tags,
|
||||||
ref,
|
ref,
|
||||||
highway,
|
highway,
|
||||||
construction,
|
subclass,
|
||||||
brunnel,
|
brunnel,
|
||||||
network,
|
network,
|
||||||
z_order
|
z_order
|
||||||
FROM osm_transportation_name_linestring_gen2
|
FROM osm_transportation_name_linestring_gen2
|
||||||
WHERE (highway = 'motorway' OR highway = 'construction' AND construction = 'motorway')
|
WHERE (highway = 'motorway' OR highway = 'construction' AND subclass = 'motorway')
|
||||||
AND ST_Length(geometry) > 20000
|
AND ST_Length(geometry) > 20000
|
||||||
;
|
;
|
||||||
CREATE TABLE IF NOT EXISTS osm_transportation_name_linestring_gen3 AS
|
CREATE TABLE IF NOT EXISTS osm_transportation_name_linestring_gen3 AS
|
||||||
|
@ -182,7 +182,7 @@ CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen3_name_ref_idx
|
||||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen3_geometry_idx ON osm_transportation_name_linestring_gen3 USING gist (geometry);
|
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen3_geometry_idx ON osm_transportation_name_linestring_gen3 USING gist (geometry);
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen3_highway_partial_idx
|
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen3_highway_partial_idx
|
||||||
ON osm_transportation_name_linestring_gen3 (highway, construction)
|
ON osm_transportation_name_linestring_gen3 (highway, subclass)
|
||||||
WHERE highway IN ('motorway', 'construction');
|
WHERE highway IN ('motorway', 'construction');
|
||||||
|
|
||||||
-- etldoc: osm_transportation_name_linestring_gen3 -> osm_transportation_name_linestring_gen4
|
-- etldoc: osm_transportation_name_linestring_gen3 -> osm_transportation_name_linestring_gen4
|
||||||
|
@ -195,12 +195,12 @@ SELECT ST_Simplify(geometry, 500) AS geometry,
|
||||||
tags,
|
tags,
|
||||||
ref,
|
ref,
|
||||||
highway,
|
highway,
|
||||||
construction,
|
subclass,
|
||||||
brunnel,
|
brunnel,
|
||||||
network,
|
network,
|
||||||
z_order
|
z_order
|
||||||
FROM osm_transportation_name_linestring_gen3
|
FROM osm_transportation_name_linestring_gen3
|
||||||
WHERE (highway = 'motorway' OR highway = 'construction' AND construction = 'motorway')
|
WHERE (highway = 'motorway' OR highway = 'construction' AND subclass = 'motorway')
|
||||||
AND ST_Length(geometry) > 20000
|
AND ST_Length(geometry) > 20000
|
||||||
;
|
;
|
||||||
CREATE TABLE IF NOT EXISTS osm_transportation_name_linestring_gen4 AS
|
CREATE TABLE IF NOT EXISTS osm_transportation_name_linestring_gen4 AS
|
||||||
|
@ -282,7 +282,7 @@ BEGIN
|
||||||
tags,
|
tags,
|
||||||
ref,
|
ref,
|
||||||
highway,
|
highway,
|
||||||
construction,
|
subclass,
|
||||||
brunnel,
|
brunnel,
|
||||||
level,
|
level,
|
||||||
layer,
|
layer,
|
||||||
|
@ -303,7 +303,7 @@ BEGIN
|
||||||
ELSE NULLIF(hl.ref, '')
|
ELSE NULLIF(hl.ref, '')
|
||||||
END AS ref,
|
END AS ref,
|
||||||
hl.highway,
|
hl.highway,
|
||||||
hl.construction,
|
hl.subclass,
|
||||||
brunnel(hl.is_bridge, hl.is_tunnel, hl.is_ford) AS brunnel,
|
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 layer END AS layer,
|
||||||
CASE WHEN highway IN ('footway', 'steps') THEN level END AS level,
|
CASE WHEN highway IN ('footway', 'steps') THEN level END AS level,
|
||||||
|
@ -369,7 +369,7 @@ CREATE TABLE IF NOT EXISTS transportation_name.name_changes
|
||||||
name_de character varying,
|
name_de character varying,
|
||||||
ref character varying,
|
ref character varying,
|
||||||
highway character varying,
|
highway character varying,
|
||||||
construction character varying,
|
subclass character varying,
|
||||||
brunnel character varying,
|
brunnel character varying,
|
||||||
level integer,
|
level integer,
|
||||||
layer integer,
|
layer integer,
|
||||||
|
@ -382,16 +382,16 @@ $$
|
||||||
BEGIN
|
BEGIN
|
||||||
IF (tg_op IN ('DELETE', 'UPDATE'))
|
IF (tg_op IN ('DELETE', 'UPDATE'))
|
||||||
THEN
|
THEN
|
||||||
INSERT INTO transportation_name.name_changes(is_old, osm_id, name, name_en, name_de, ref, highway, construction,
|
INSERT INTO transportation_name.name_changes(is_old, osm_id, name, name_en, name_de, ref, highway, subclass,
|
||||||
brunnel, level, layer, indoor, network_type)
|
brunnel, level, layer, indoor, network_type)
|
||||||
VALUES (TRUE, old.osm_id, old.name, old.name_en, old.name_de, old.ref, old.highway, old.construction,
|
VALUES (TRUE, old.osm_id, old.name, old.name_en, old.name_de, old.ref, old.highway, old.subclass,
|
||||||
old.brunnel, old.level, old.layer, old.indoor, old.network_type);
|
old.brunnel, old.level, old.layer, old.indoor, old.network_type);
|
||||||
END IF;
|
END IF;
|
||||||
IF (tg_op IN ('UPDATE', 'INSERT'))
|
IF (tg_op IN ('UPDATE', 'INSERT'))
|
||||||
THEN
|
THEN
|
||||||
INSERT INTO transportation_name.name_changes(is_old, osm_id, name, name_en, name_de, ref, highway, construction,
|
INSERT INTO transportation_name.name_changes(is_old, osm_id, name, name_en, name_de, ref, highway, subclass,
|
||||||
brunnel, level, layer, indoor, network_type)
|
brunnel, level, layer, indoor, network_type)
|
||||||
VALUES (FALSE, new.osm_id, new.name, new.name_en, new.name_de, new.ref, new.highway, new.construction,
|
VALUES (FALSE, new.osm_id, new.name, new.name_en, new.name_de, new.ref, new.highway, new.subclass,
|
||||||
new.brunnel, new.level, new.layer, new.indoor, new.network_type);
|
new.brunnel, new.level, new.layer, new.indoor, new.network_type);
|
||||||
END IF;
|
END IF;
|
||||||
RETURN NULL;
|
RETURN NULL;
|
||||||
|
@ -423,13 +423,13 @@ BEGIN
|
||||||
|
|
||||||
-- Compact the change history to keep only the first and last version, and then uniq version of row
|
-- 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
|
CREATE TEMP TABLE name_changes_compact AS
|
||||||
SELECT DISTINCT ON (name, name_en, name_de, ref, highway, construction, brunnel, level, layer, indoor, network_type)
|
SELECT DISTINCT ON (name, name_en, name_de, ref, highway, subclass, brunnel, level, layer, indoor, network_type)
|
||||||
name,
|
name,
|
||||||
name_en,
|
name_en,
|
||||||
name_de,
|
name_de,
|
||||||
ref,
|
ref,
|
||||||
highway,
|
highway,
|
||||||
construction,
|
subclass,
|
||||||
brunnel,
|
brunnel,
|
||||||
level,
|
level,
|
||||||
layer,
|
layer,
|
||||||
|
@ -460,7 +460,7 @@ BEGIN
|
||||||
AND n.name_en IS NOT DISTINCT FROM c.name_en
|
AND n.name_en IS NOT DISTINCT FROM c.name_en
|
||||||
AND n.name_de IS NOT DISTINCT FROM c.name_de
|
AND n.name_de IS NOT DISTINCT FROM c.name_de
|
||||||
AND n.highway IS NOT DISTINCT FROM c.highway
|
AND n.highway IS NOT DISTINCT FROM c.highway
|
||||||
AND n.construction IS NOT DISTINCT FROM c.construction
|
AND n.subclass IS NOT DISTINCT FROM c.subclass
|
||||||
AND n.brunnel IS NOT DISTINCT FROM c.brunnel
|
AND n.brunnel IS NOT DISTINCT FROM c.brunnel
|
||||||
AND n.level IS NOT DISTINCT FROM c.level
|
AND n.level IS NOT DISTINCT FROM c.level
|
||||||
AND n.layer IS NOT DISTINCT FROM c.layer
|
AND n.layer IS NOT DISTINCT FROM c.layer
|
||||||
|
@ -476,7 +476,7 @@ BEGIN
|
||||||
tags || get_basic_names(tags, geometry) AS tags,
|
tags || get_basic_names(tags, geometry) AS tags,
|
||||||
ref,
|
ref,
|
||||||
highway,
|
highway,
|
||||||
construction,
|
subclass,
|
||||||
brunnel,
|
brunnel,
|
||||||
level,
|
level,
|
||||||
layer,
|
layer,
|
||||||
|
@ -493,7 +493,7 @@ BEGIN
|
||||||
''), ',')) AS tags,
|
''), ',')) AS tags,
|
||||||
n.ref,
|
n.ref,
|
||||||
n.highway,
|
n.highway,
|
||||||
n.construction,
|
n.subclass,
|
||||||
n.brunnel,
|
n.brunnel,
|
||||||
n.level,
|
n.level,
|
||||||
n.layer,
|
n.layer,
|
||||||
|
@ -507,13 +507,13 @@ BEGIN
|
||||||
AND n.name_en IS NOT DISTINCT FROM c.name_en
|
AND n.name_en IS NOT DISTINCT FROM c.name_en
|
||||||
AND n.name_de IS NOT DISTINCT FROM c.name_de
|
AND n.name_de IS NOT DISTINCT FROM c.name_de
|
||||||
AND n.highway IS NOT DISTINCT FROM c.highway
|
AND n.highway IS NOT DISTINCT FROM c.highway
|
||||||
AND n.construction IS NOT DISTINCT FROM c.construction
|
AND n.subclass IS NOT DISTINCT FROM c.subclass
|
||||||
AND n.brunnel IS NOT DISTINCT FROM c.brunnel
|
AND n.brunnel IS NOT DISTINCT FROM c.brunnel
|
||||||
AND n.level IS NOT DISTINCT FROM c.level
|
AND n.level IS NOT DISTINCT FROM c.level
|
||||||
AND n.layer IS NOT DISTINCT FROM c.layer
|
AND n.layer IS NOT DISTINCT FROM c.layer
|
||||||
AND n.indoor IS NOT DISTINCT FROM c.indoor
|
AND n.indoor IS NOT DISTINCT FROM c.indoor
|
||||||
AND n.network_type IS NOT DISTINCT FROM c.network_type
|
AND n.network_type IS NOT DISTINCT FROM c.network_type
|
||||||
GROUP BY n.name, n.name_en, n.name_de, n.ref, n.highway, n.construction, n.brunnel, n.level, n.layer, n.indoor, n.network_type
|
GROUP BY n.name, n.name_en, n.name_de, n.ref, n.highway, n.subclass, n.brunnel, n.level, n.layer, n.indoor, n.network_type
|
||||||
) AS highway_union;
|
) AS highway_union;
|
||||||
|
|
||||||
-- REFRESH osm_transportation_name_linestring_gen1
|
-- REFRESH osm_transportation_name_linestring_gen1
|
||||||
|
@ -526,7 +526,7 @@ BEGIN
|
||||||
AND n.name_de IS NOT DISTINCT FROM c.name_de
|
AND n.name_de IS NOT DISTINCT FROM c.name_de
|
||||||
AND n.ref IS NOT DISTINCT FROM c.ref
|
AND n.ref IS NOT DISTINCT FROM c.ref
|
||||||
AND n.highway IS NOT DISTINCT FROM c.highway
|
AND n.highway IS NOT DISTINCT FROM c.highway
|
||||||
AND n.construction IS NOT DISTINCT FROM c.construction
|
AND n.subclass IS NOT DISTINCT FROM c.subclass
|
||||||
AND n.brunnel IS NOT DISTINCT FROM c.brunnel
|
AND n.brunnel IS NOT DISTINCT FROM c.brunnel
|
||||||
AND n.network IS NOT DISTINCT FROM c.network_type;
|
AND n.network IS NOT DISTINCT FROM c.network_type;
|
||||||
|
|
||||||
|
@ -540,7 +540,7 @@ BEGIN
|
||||||
AND n.name_de IS NOT DISTINCT FROM c.name_de
|
AND n.name_de IS NOT DISTINCT FROM c.name_de
|
||||||
AND n.ref IS NOT DISTINCT FROM c.ref
|
AND n.ref IS NOT DISTINCT FROM c.ref
|
||||||
AND n.highway IS NOT DISTINCT FROM c.highway
|
AND n.highway IS NOT DISTINCT FROM c.highway
|
||||||
AND n.construction IS NOT DISTINCT FROM c.construction
|
AND n.subclass IS NOT DISTINCT FROM c.subclass
|
||||||
AND n.brunnel IS NOT DISTINCT FROM c.brunnel
|
AND n.brunnel IS NOT DISTINCT FROM c.brunnel
|
||||||
AND n.network IS NOT DISTINCT FROM c.network_type;
|
AND n.network IS NOT DISTINCT FROM c.network_type;
|
||||||
|
|
||||||
|
@ -554,7 +554,7 @@ BEGIN
|
||||||
AND n.name_de IS NOT DISTINCT FROM c.name_de
|
AND n.name_de IS NOT DISTINCT FROM c.name_de
|
||||||
AND n.ref IS NOT DISTINCT FROM c.ref
|
AND n.ref IS NOT DISTINCT FROM c.ref
|
||||||
AND n.highway IS NOT DISTINCT FROM c.highway
|
AND n.highway IS NOT DISTINCT FROM c.highway
|
||||||
AND n.construction IS NOT DISTINCT FROM c.construction
|
AND n.subclass IS NOT DISTINCT FROM c.subclass
|
||||||
AND n.brunnel IS NOT DISTINCT FROM c.brunnel
|
AND n.brunnel IS NOT DISTINCT FROM c.brunnel
|
||||||
AND n.network IS NOT DISTINCT FROM c.network_type;
|
AND n.network IS NOT DISTINCT FROM c.network_type;
|
||||||
|
|
||||||
|
@ -568,7 +568,7 @@ BEGIN
|
||||||
AND n.name_de IS NOT DISTINCT FROM c.name_de
|
AND n.name_de IS NOT DISTINCT FROM c.name_de
|
||||||
AND n.ref IS NOT DISTINCT FROM c.ref
|
AND n.ref IS NOT DISTINCT FROM c.ref
|
||||||
AND n.highway IS NOT DISTINCT FROM c.highway
|
AND n.highway IS NOT DISTINCT FROM c.highway
|
||||||
AND n.construction IS NOT DISTINCT FROM c.construction
|
AND n.subclass IS NOT DISTINCT FROM c.subclass
|
||||||
AND n.brunnel IS NOT DISTINCT FROM c.brunnel
|
AND n.brunnel IS NOT DISTINCT FROM c.brunnel
|
||||||
AND n.network IS NOT DISTINCT FROM c.network_type;
|
AND n.network IS NOT DISTINCT FROM c.network_type;
|
||||||
|
|
||||||
|
@ -582,7 +582,7 @@ BEGIN
|
||||||
AND n.name_de IS NOT DISTINCT FROM c.name_de
|
AND n.name_de IS NOT DISTINCT FROM c.name_de
|
||||||
AND n.ref IS NOT DISTINCT FROM c.ref
|
AND n.ref IS NOT DISTINCT FROM c.ref
|
||||||
AND n.highway IS NOT DISTINCT FROM c.highway
|
AND n.highway IS NOT DISTINCT FROM c.highway
|
||||||
AND n.construction IS NOT DISTINCT FROM c.construction
|
AND n.subclass IS NOT DISTINCT FROM c.subclass
|
||||||
AND n.brunnel IS NOT DISTINCT FROM c.brunnel
|
AND n.brunnel IS NOT DISTINCT FROM c.brunnel
|
||||||
AND n.network IS NOT DISTINCT FROM c.network_type;
|
AND n.network IS NOT DISTINCT FROM c.network_type;
|
||||||
|
|
||||||
|
@ -596,7 +596,7 @@ BEGIN
|
||||||
AND n.name_de IS NOT DISTINCT FROM c.name_de
|
AND n.name_de IS NOT DISTINCT FROM c.name_de
|
||||||
AND n.ref IS NOT DISTINCT FROM c.ref
|
AND n.ref IS NOT DISTINCT FROM c.ref
|
||||||
AND n.highway IS NOT DISTINCT FROM c.highway
|
AND n.highway IS NOT DISTINCT FROM c.highway
|
||||||
AND n.construction IS NOT DISTINCT FROM c.construction
|
AND n.subclass IS NOT DISTINCT FROM c.subclass
|
||||||
AND n.brunnel IS NOT DISTINCT FROM c.brunnel
|
AND n.brunnel IS NOT DISTINCT FROM c.brunnel
|
||||||
AND n.network IS NOT DISTINCT FROM c.network_type;
|
AND n.network IS NOT DISTINCT FROM c.network_type;
|
||||||
|
|
||||||
|
@ -610,7 +610,7 @@ BEGIN
|
||||||
AND n.name_de IS NOT DISTINCT FROM c.name_de
|
AND n.name_de IS NOT DISTINCT FROM c.name_de
|
||||||
AND n.ref IS NOT DISTINCT FROM c.ref
|
AND n.ref IS NOT DISTINCT FROM c.ref
|
||||||
AND n.highway IS NOT DISTINCT FROM c.highway
|
AND n.highway IS NOT DISTINCT FROM c.highway
|
||||||
AND n.construction IS NOT DISTINCT FROM c.construction
|
AND n.subclass IS NOT DISTINCT FROM c.subclass
|
||||||
AND n.brunnel IS NOT DISTINCT FROM c.brunnel
|
AND n.brunnel IS NOT DISTINCT FROM c.brunnel
|
||||||
AND n.network IS NOT DISTINCT FROM c.network_type;
|
AND n.network IS NOT DISTINCT FROM c.network_type;
|
||||||
|
|
||||||
|
@ -624,7 +624,7 @@ BEGIN
|
||||||
AND n.name_de IS NOT DISTINCT FROM c.name_de
|
AND n.name_de IS NOT DISTINCT FROM c.name_de
|
||||||
AND n.ref IS NOT DISTINCT FROM c.ref
|
AND n.ref IS NOT DISTINCT FROM c.ref
|
||||||
AND n.highway IS NOT DISTINCT FROM c.highway
|
AND n.highway IS NOT DISTINCT FROM c.highway
|
||||||
AND n.construction IS NOT DISTINCT FROM c.construction
|
AND n.subclass IS NOT DISTINCT FROM c.subclass
|
||||||
AND n.brunnel IS NOT DISTINCT FROM c.brunnel
|
AND n.brunnel IS NOT DISTINCT FROM c.brunnel
|
||||||
AND n.network IS NOT DISTINCT FROM c.network_type;
|
AND n.network IS NOT DISTINCT FROM c.network_type;
|
||||||
|
|
||||||
|
|