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:
parent
9e4be3e3b0
commit
08bb2a06c0
Binary file not shown.
|
Before Width: | Height: | Size: 552 KiB After Width: | Height: | Size: 556 KiB |
@ -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,
|
||||
|
||||
@ -111,6 +111,12 @@ layer:
|
||||
- bridleway
|
||||
- corridor
|
||||
- platform
|
||||
network:
|
||||
description: |
|
||||
The network type derived mainly from [`network`](http://wiki.openstreetmap.org/wiki/Key:network) tag of the road.
|
||||
See more info about [`us-*`](http://wiki.openstreetmap.org/wiki/Road_signs_in_the_United_States),
|
||||
[`ca-transcanada`](https://en.wikipedia.org/wiki/Trans-Canada_Highway),
|
||||
or [`gb-*`](http://wiki.openstreetmap.org/wiki/United_Kingdom_Tagging_Guidelines#UK_roads).
|
||||
brunnel:
|
||||
description: |
|
||||
Mark whether way is a tunnel or bridge.
|
||||
@ -174,9 +180,11 @@ layer:
|
||||
datasource:
|
||||
geometry_field: geometry
|
||||
srid: 900913
|
||||
query: (SELECT geometry, class, subclass, oneway, ramp, brunnel, service, layer, level, indoor, bicycle, foot, horse, mtb_scale, surface FROM layer_transportation(!bbox!, z(!scale_denominator!))) AS t
|
||||
query: (SELECT geometry, class, subclass, network, oneway, ramp, brunnel, service, layer, level, indoor, bicycle, foot, horse, mtb_scale, surface FROM layer_transportation(!bbox!, z(!scale_denominator!))) AS t
|
||||
schema:
|
||||
- ./network_type.sql
|
||||
- ./class.sql
|
||||
- ./update_route_member.sql
|
||||
- ./update_transportation_merge.sql
|
||||
- ./transportation.sql
|
||||
datasources:
|
||||
|
||||
@ -85,3 +85,13 @@ INSERT INTO osm_route_member (id, concurrency_index)
|
||||
ROW_NUMBER() over (PARTITION BY member ORDER BY network_type, network, LENGTH(ref), ref) AS concurrency_index
|
||||
FROM osm_route_member
|
||||
ON CONFLICT (id) DO UPDATE SET concurrency_index = EXCLUDED.concurrency_index;
|
||||
|
||||
UPDATE osm_highway_linestring hl
|
||||
SET network = rm.network_type
|
||||
FROM osm_route_member rm
|
||||
WHERE hl.osm_id=rm.member AND rm.concurrency_index=1;
|
||||
|
||||
UPDATE osm_highway_linestring_gen_z11 hl
|
||||
SET network = rm.network_type
|
||||
FROM osm_route_member rm
|
||||
WHERE hl.osm_id=rm.member AND rm.concurrency_index=1;
|
||||
@ -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,
|
||||
@ -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,
|
||||
@ -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,
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 232 KiB After Width: | Height: | Size: 258 KiB |
@ -184,7 +184,6 @@ FROM (
|
||||
NULL::boolean AS indoor
|
||||
FROM osm_highway_point p
|
||||
WHERE highway = 'motorway_junction' AND zoom_level >= 10
|
||||
|
||||
) AS zoom_levels
|
||||
WHERE geometry && bbox
|
||||
ORDER BY z_order ASC;
|
||||
|
||||
@ -104,9 +104,7 @@ layer:
|
||||
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, route_2, route_3, route_4, route_5, route_6 FROM layer_transportation_name(!bbox!, z(!scale_denominator!))) AS t
|
||||
schema:
|
||||
- ./network_type.sql
|
||||
- ./highway_classification.sql
|
||||
- ./update_route_member.sql
|
||||
- ./update_transportation_name.sql
|
||||
- ./transportation_name.sql
|
||||
datasources:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user