mirror of
https://github.com/openmaptiles/openmaptiles.git
synced 2025-12-08 18:02:18 +00:00
Fixes #1128 This PR adds 6 new columns to the `transportation_name` column, named `route_1` through `route_6`. These columns contain route information for a section of roadway. The value is stored in the form **network=ref**. For example, Interstate 95 in the United States would be `US:I=95`. Thus, each `route_N` value contains enough information to render a highway shield. Since a section of road can be a part of more than one route, the `route_2`, `route_3`, etc, will contain the 2nd, 3rd, etc., concurrent routes. The technical approach was to extend the change in #1135, which added ordered concurrency indexes to the `osm_route_member` table by joining up to the the first six entries to the `osm_transportation_name_network` table. In addition, that PR provided a ranking system for concurrent highways, ordering first by `network_type` (for example, `us-interstate`, `us-state`, etc), then alphabetically by network name, and then by ref in ascending order. This ordering of concurrent route memberships is now exposed in this PR in the sequential `route_N` values, meaning that rendered concurrent highway shields will be reasonably sorted. The renderings below were generated using this branch of OpenMapTiles, as well as a separate branch of openstreetmap-americana: https://github.com/ZeLonewolf/openstreetmap-americana/tree/openmaptilers-new-features-test The rendering approach is to use the [formatted expressions](https://maplibre.org/maplibre-gl-js-docs/style-spec/expressions/) feature in mapLibre to insert images into a string of text. Blank shields are added to the sprite sheet for all possible route networks. Next, a [styleimagemissing](https://maplibre.org/maplibre-gl-js-docs/api/map/) callback is registered. As each shield ID is requested, the callback retrieves the sprite shield blank associated with the route's network, draw the `ref` text on the shield, and insert the complete shield back into the map. Of note, this approach currently results in shields which are rotated about the road rather than being viewport aligned. This issue is currently documented as maplibre/maplibre-gl-js#188. A separate repository (https://github.com/ZeLonewolf/maplibre-shield-rotation-sample) has been created as a test case to fix this rotation issue. Adding route concurrency information to OpenMapTiles would be a major step forward in achieving comprehensive highway shield renderings in a vector map! **Renderings**:    
115 lines
4.4 KiB
YAML
115 lines
4.4 KiB
YAML
layer:
|
|
id: "transportation_name"
|
|
# transportation_name relies on the function highway_class() defined in transportation layer
|
|
requires: "transportation"
|
|
description: |
|
|
This is the layer for labelling the highways. Only highways that are named `name=*` and are long enough
|
|
to place text upon appear. The OSM roads are stitched together if they contain the same name
|
|
to have better label placement than having many small linestrings.
|
|
For motorways you should use the `ref` field to label them while for other roads you should use `name`.
|
|
buffer_size: 8
|
|
srs: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over
|
|
fields:
|
|
name: The OSM [`name`](http://wiki.openstreetmap.org/wiki/Highways#Names_and_references) value of the highway.
|
|
name_en: English name `name:en` if available, otherwise `name`.
|
|
name_de: German name `name:de` if available, otherwise `name` or `name:en`.
|
|
ref: The OSM [`ref`](http://wiki.openstreetmap.org/wiki/Key:ref) tag of the motorway or its network.
|
|
ref_length: Length of the `ref` field. Useful for having a shield icon as background for labeling motorways.
|
|
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).
|
|
values:
|
|
- us-interstate
|
|
- us-highway
|
|
- us-state
|
|
- ca-transcanada
|
|
- gb-motorway
|
|
- gb-trunk
|
|
- road (default)
|
|
class:
|
|
description: |
|
|
Distinguish between more and less important roads and roads under construction.
|
|
values:
|
|
- motorway
|
|
- trunk
|
|
- primary
|
|
- secondary
|
|
- tertiary
|
|
- minor
|
|
- service
|
|
- track
|
|
- path
|
|
- raceway
|
|
- motorway_construction
|
|
- trunk_construction
|
|
- primary_construction
|
|
- secondary_construction
|
|
- tertiary_construction
|
|
- minor_construction
|
|
- service_construction
|
|
- track_construction
|
|
- path_construction
|
|
- raceway_construction
|
|
- rail
|
|
- transit
|
|
- motorway_junction
|
|
subclass:
|
|
description: |
|
|
Distinguish more specific classes of path:
|
|
Subclass is value of the
|
|
[`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:
|
|
- pedestrian
|
|
- path
|
|
- footway
|
|
- cycleway
|
|
- steps
|
|
- bridleway
|
|
- corridor
|
|
- platform
|
|
- junction
|
|
brunnel:
|
|
description: |
|
|
Mark whether way is a bridge, a tunnel or a ford.
|
|
values:
|
|
- bridge
|
|
- tunnel
|
|
- ford
|
|
level:
|
|
description: |
|
|
Experimental feature! Filled only for steps and footways. Original
|
|
value of [`level`](http://wiki.openstreetmap.org/wiki/Key:level) tag.
|
|
layer:
|
|
description: |
|
|
Experimental feature! Filled only for steps and footways. Original
|
|
value of [`layer`](http://wiki.openstreetmap.org/wiki/Key:layer) tag.
|
|
indoor:
|
|
description: |
|
|
Experimental feature! Filled only for steps and footways. Original
|
|
value of [`indoor`](http://wiki.openstreetmap.org/wiki/Key:indoor) tag.
|
|
values:
|
|
- 1
|
|
route_1: 1st route concurrency.
|
|
route_2: 2nd route concurrency.
|
|
route_3: 3rd route concurrency.
|
|
route_4: 4th route concurrency.
|
|
route_5: 5th route concurrency.
|
|
route_6: 6th route concurrency.
|
|
datasource:
|
|
geometry_field: geometry
|
|
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:
|
|
- type: imposm3
|
|
mapping_file: ../transportation/mapping.yaml
|