New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement concurrent highway routes #1152
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Results evaluating commit bacdad0 (merged with base 3c15679 as a71942c). See run details. PostgreSQL DB size in MB: 2786 ⇒ 2786 (0.0% change)
expand for details...
|
TomPohys
approved these changes
Jul 26, 2021
Thanks a lot. It looks awesome! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1128
This PR adds 6 new columns to the
transportation_name
column, namedroute_1
throughroute_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 beUS:I=95
. Thus, eachroute_N
value contains enough information to render a highway shield. Since a section of road can be a part of more than one route, theroute_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 theosm_transportation_name_network
table. In addition, that PR provided a ranking system for concurrent highways, ordering first bynetwork_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 sequentialroute_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 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 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: