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.
![image](https://user-images.githubusercontent.com/3254090/126420985-c380b54b-a991-4a7c-a4c1-40a5cf5ec6b0.png)

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:
![image](https://user-images.githubusercontent.com/3254090/126421148-71e780ec-991d-4e38-a82a-85015b349e97.png)
This commit is contained in:
Brian Sperlongano
2021-08-04 04:10:16 -04:00
committed by GitHub
parent 9e4be3e3b0
commit 08bb2a06c0
9 changed files with 57 additions and 8 deletions

View File

@@ -15,6 +15,7 @@ CREATE OR REPLACE FUNCTION layer_transportation(bbox geometry, zoom_level int)
geometry geometry,
class text,
subclass text,
network text,
ramp int,
oneway int,
brunnel text,
@@ -47,6 +48,7 @@ SELECT osm_id,
THEN COALESCE(NULLIF(public_transport, ''), highway)
WHEN aerialway IS NOT NULL THEN aerialway
END AS subclass,
NULLIF(network, '') AS network,
-- All links are considered as ramps as well
CASE
WHEN highway_is_link(highway) OR highway = 'steps'
@@ -69,6 +71,7 @@ FROM (
geometry,
highway,
construction,
network,
NULL AS railway,
NULL AS aerialway,
NULL AS shipway,
@@ -98,6 +101,7 @@ FROM (
geometry,
highway,
construction,
network,
NULL AS railway,
NULL AS aerialway,
NULL AS shipway,
@@ -127,6 +131,7 @@ FROM (
geometry,
highway,
construction,
network,
NULL AS railway,
NULL AS aerialway,
NULL AS shipway,
@@ -156,6 +161,7 @@ FROM (
geometry,
highway,
construction,
network,
NULL AS railway,
NULL AS aerialway,
NULL AS shipway,
@@ -185,6 +191,7 @@ FROM (
geometry,
highway,
construction,
network,
NULL AS railway,
NULL AS aerialway,
NULL AS shipway,
@@ -214,6 +221,7 @@ FROM (
geometry,
highway,
construction,
network,
NULL AS railway,
NULL AS aerialway,
NULL AS shipway,
@@ -243,6 +251,7 @@ FROM (
geometry,
highway,
construction,
network,
NULL AS railway,
NULL AS aerialway,
NULL AS shipway,
@@ -272,6 +281,7 @@ FROM (
geometry,
highway,
construction,
network,
NULL AS railway,
NULL AS aerialway,
NULL AS shipway,
@@ -303,6 +313,7 @@ FROM (
geometry,
highway,
construction,
network,
NULL AS railway,
NULL AS aerialway,
NULL AS shipway,
@@ -351,6 +362,7 @@ FROM (
geometry,
NULL AS highway,
NULL AS construction,
NULL AS network,
railway,
NULL AS aerialway,
NULL AS shipway,
@@ -383,6 +395,7 @@ FROM (
geometry,
NULL AS highway,
NULL AS construction,
NULL AS network,
railway,
NULL AS aerialway,
NULL AS shipway,
@@ -415,6 +428,7 @@ FROM (
geometry,
NULL AS highway,
NULL AS construction,
NULL AS network,
railway,
NULL AS aerialway,
NULL AS shipway,
@@ -446,6 +460,7 @@ FROM (
geometry,
NULL AS highway,
NULL AS construction,
NULL AS network,
railway,
NULL AS aerialway,
NULL AS shipway,
@@ -477,6 +492,7 @@ FROM (
geometry,
NULL AS highway,
NULL AS construction,
NULL AS network,
railway,
NULL AS aerialway,
NULL AS shipway,
@@ -509,6 +525,7 @@ FROM (
geometry,
NULL AS highway,
NULL AS construction,
NULL AS network,
railway,
NULL AS aerialway,
NULL AS shipway,
@@ -541,6 +558,7 @@ FROM (
geometry,
NULL AS highway,
NULL AS construction,
NULL AS network,
NULL AS railway,
aerialway,
NULL AS shipway,
@@ -571,6 +589,7 @@ FROM (
geometry,
NULL AS highway,
NULL AS construction,
NULL AS network,
NULL AS railway,
aerialway,
NULL AS shipway,
@@ -600,6 +619,7 @@ FROM (
geometry,
NULL AS highway,
NULL AS construction,
NULL AS network,
NULL AS railway,
NULL AS aerialway,
shipway,
@@ -629,6 +649,7 @@ FROM (
geometry,
NULL AS highway,
NULL AS construction,
NULL AS network,
NULL AS railway,
NULL AS aerialway,
shipway,
@@ -659,6 +680,7 @@ FROM (
geometry,
NULL AS highway,
NULL AS construction,
NULL AS network,
NULL AS railway,
NULL AS aerialway,
shipway,
@@ -693,6 +715,7 @@ FROM (
geometry,
highway,
NULL AS construction,
NULL AS network,
NULL AS railway,
NULL AS aerialway,
NULL AS shipway,