Add network to transport layer (#1158)
Closes #1153 This PR populates the existing `network_type` field in the route table with highway route network information, using the most important value in cases of concurrencies. In order to expose this value, two files `network_type.sql` and `update_route_member.sql` were moved from the `transportation_name` layer to the `transportation` layer. Below is a representative zoom level 6 with motorways only shown for `us-interstate` network types. This sample was generated from this PR using a [custom branch](https://github.com/ZeLonewolf/openstreetmap-americana/tree/selective-highway-zoom) of openstreetmap-americana. This provides a simplified rendering of the highway network which excludes many minor motorway roads and sections.  Below is zoom level 6 on the current [openstreetmap-americana](https://zelonewolf.github.io/openstreetmap-americana/#6/42.148/-73.712). Notice the many additional stubs, motorway islands, and minor routes which are present. Instead of rendering `highway=trunk` to make this network look nice, we can instead suppress non-interstate roads and withhold motorway+trunk rendering to a closer zoom: 
This commit is contained in:
committed by
GitHub
parent
9e4be3e3b0
commit
08bb2a06c0
@@ -19,6 +19,7 @@ CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen_z11 AS
|
||||
SELECT (ST_Dump(geometry)).geom AS geometry,
|
||||
NULL::bigint AS osm_id,
|
||||
highway,
|
||||
network,
|
||||
construction,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
@@ -32,6 +33,7 @@ SELECT (ST_Dump(geometry)).geom AS geometry,
|
||||
FROM (
|
||||
SELECT ST_LineMerge(ST_Collect(geometry)) AS geometry,
|
||||
highway,
|
||||
network,
|
||||
construction,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
@@ -44,7 +46,7 @@ FROM (
|
||||
layer
|
||||
FROM osm_highway_linestring_gen_z11
|
||||
WHERE ST_IsValid(geometry)
|
||||
GROUP BY highway, construction, is_bridge, is_tunnel, is_ford, bicycle, foot, horse, mtb_scale, layer
|
||||
GROUP BY highway, network, construction, is_bridge, is_tunnel, is_ford, bicycle, foot, horse, mtb_scale, layer
|
||||
) AS highway_union
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen_z11_geometry_idx
|
||||
@@ -57,6 +59,7 @@ CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen_z10 AS
|
||||
SELECT ST_Simplify(geometry, ZRes(12)) AS geometry,
|
||||
osm_id,
|
||||
highway,
|
||||
network,
|
||||
construction,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
@@ -68,7 +71,7 @@ SELECT ST_Simplify(geometry, ZRes(12)) AS geometry,
|
||||
mtb_scale,
|
||||
layer
|
||||
FROM osm_transportation_merge_linestring_gen_z11
|
||||
WHERE highway NOT IN ('tertiary', 'tertiary_link')
|
||||
WHERE highway NOT IN ('tertiary', 'tertiary_link')
|
||||
OR highway = 'construction' AND construction NOT IN ('tertiary', 'tertiary_link')
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen_z10_geometry_idx
|
||||
@@ -81,6 +84,7 @@ CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen_z9 AS
|
||||
SELECT ST_Simplify(geometry, ZRes(11)) AS geometry,
|
||||
osm_id,
|
||||
highway,
|
||||
network,
|
||||
construction,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
@@ -92,7 +96,7 @@ SELECT ST_Simplify(geometry, ZRes(11)) AS geometry,
|
||||
mtb_scale,
|
||||
layer
|
||||
FROM osm_transportation_merge_linestring_gen_z10
|
||||
WHERE highway NOT IN ('tertiary', 'tertiary_link')
|
||||
WHERE highway NOT IN ('tertiary', 'tertiary_link')
|
||||
OR highway = 'construction' AND construction NOT IN ('tertiary', 'tertiary_link')
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen_z9_geometry_idx
|
||||
@@ -105,6 +109,7 @@ CREATE MATERIALIZED VIEW osm_transportation_merge_linestring AS
|
||||
SELECT (ST_Dump(geometry)).geom AS geometry,
|
||||
NULL::bigint AS osm_id,
|
||||
highway,
|
||||
network,
|
||||
construction,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
@@ -113,6 +118,7 @@ SELECT (ST_Dump(geometry)).geom AS geometry,
|
||||
FROM (
|
||||
SELECT ST_LineMerge(ST_Collect(geometry)) AS geometry,
|
||||
highway,
|
||||
network,
|
||||
construction,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
@@ -122,7 +128,7 @@ FROM (
|
||||
WHERE (highway IN ('motorway', 'trunk', 'primary') OR
|
||||
highway = 'construction' AND construction IN ('motorway', 'trunk', 'primary'))
|
||||
AND ST_IsValid(geometry)
|
||||
GROUP BY highway, construction, is_bridge, is_tunnel, is_ford
|
||||
GROUP BY highway, network, construction, is_bridge, is_tunnel, is_ford
|
||||
) AS highway_union
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_geometry_idx
|
||||
@@ -135,6 +141,7 @@ CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen_z8 AS
|
||||
SELECT ST_Simplify(geometry, ZRes(10)) AS geometry,
|
||||
osm_id,
|
||||
highway,
|
||||
network,
|
||||
construction,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
@@ -154,6 +161,7 @@ CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen_z7 AS
|
||||
SELECT ST_Simplify(geometry, ZRes(9)) AS geometry,
|
||||
osm_id,
|
||||
highway,
|
||||
network,
|
||||
construction,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
@@ -174,6 +182,7 @@ CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen_z6 AS
|
||||
SELECT ST_Simplify(geometry, ZRes(8)) AS geometry,
|
||||
osm_id,
|
||||
highway,
|
||||
network,
|
||||
construction,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
@@ -193,6 +202,7 @@ CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen_z5 AS
|
||||
SELECT ST_Simplify(geometry, ZRes(7)) AS geometry,
|
||||
osm_id,
|
||||
highway,
|
||||
network,
|
||||
construction,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
@@ -212,6 +222,7 @@ CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen_z4 AS
|
||||
SELECT ST_Simplify(geometry, ZRes(6)) AS geometry,
|
||||
osm_id,
|
||||
highway,
|
||||
network,
|
||||
construction,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
|
||||
Reference in New Issue
Block a user