Skip to content
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

Roads under construction #215

Closed
wants to merge 4 commits into from
Closed

Roads under construction #215

wants to merge 4 commits into from

Conversation

1ec5
Copy link
Collaborator

@1ec5 1ec5 commented Mar 6, 2022

Added path and casing line layers for roads under construction, which are depicted as broken lines. Labels for these roads end with the annotation “(UNDER CONSTRUCTION)” is slightly smaller type.

Examples

samples.mov
z7 z8 z9 z10 z11
sample-z7 sample-z8 sample-z9 sample-z10 sample-z11
z12 z13 z14 z15 z16
sample-z12 sample-z13 sample-z14 sample-z15 sample-z16
a35-480p.mov
z7 z8 z9 z10 z11
a35-z7 a35-z8 a35-z9 a35-z10 a35-z11
z12 z13 z14 z15 z16
a35-z12 a35-z13 a35-z14 a35-z15 a35-z16

Caveats

Aligning the path and casing line layers has been a challenge. The standard approach to casing – putting a wider line layer below the path line layer – breaks down along curved lines, because the line-dasharray paint property is scaled by the line width. Instead, both layers have the same line width, but the casing layer has a line-gap-width property. Despite the property being measured in pixels, I can’t get the casing to be any thinner than 5 pixels wide.

I gave the dashes and gaps an exponential ramp that should keep it discernible as a broken line at any zoom level. Unfortunately, the dash pattern shows seams at tile boundaries or anywhere two LineString features connect, such as at the ends of bridges. (I gave bridges and tunnels under construction exactly the same style, for simplicity.) It’s also very easy for divided highways to wind up with alternating dash patterns that blend into one another at some zoom levels.

I’ve marked this PR as a draft not because these imperfections are fatal to the broken line concept but rather because the code changes are so messy. The road line code is very rigidly structured but shows signs of strain with these changes. The line-gap-width approach breaks the assumption that there are distinct line widths for the path versus the casing, and the mere presence of a construction variant of each road layer means lots of conditionals. Since each layer definition is ultimately an object, we probably should be relying on prototypes instead of classes and the Builder pattern (no pun intended).

Fixes #212.

@1ec5 1ec5 added enhancement New feature or request highway-lines labels Mar 6, 2022
@1ec5 1ec5 self-assigned this Mar 6, 2022
@ZeLonewolf
Copy link
Owner

The fact that we don't have merged lines on dual carriageways is squarely a server-side problem, and I'm comfortable ignoring unwanted display artifacts due to that. I'm thinking the same about the tile boundary artifacts, and am hoping this is something that can some day be resolved in maplibre.

@ZeLonewolf
Copy link
Owner

The use of a hard-coded English label is new ground for this style. Is there a path to i18n of this and any other fixed strings in the event someone wants to implement a language switcher?

@1ec5
Copy link
Collaborator Author

1ec5 commented Mar 6, 2022

The use of a hard-coded English label is new ground for this style. Is there a path to i18n of this and any other fixed strings in the event someone wants to implement a language switcher?

I factored out the suffix into a translation table with code to automatically select the translation that best matches the user’s locale. In time, we can factor it out again into a separate file in a format like Structured JSON that a translation management system like Transifex can understand.

Bajo Construcción

@1ec5 1ec5 mentioned this pull request Mar 7, 2022
5 tasks
Added fill and casing layers for roads under construction, which are depicted as broken lines.
@matkoniecz
Copy link
Contributor

matkoniecz commented May 25, 2022

Is it planned to display tunnel/bridge status?

See say https://zelonewolf.github.io/openstreetmap-americana/#13.72/49.65875/19.90932 tunnel

@1ec5 1ec5 mentioned this pull request May 28, 2022
@1ec5
Copy link
Collaborator Author

1ec5 commented May 28, 2022

For visual simplicity, I did not include special treatment of tunnels and bridges under construction. The idea is that a road under construction is only being “sketched in” with a broken line, making it unnecessary to faithfully represent how it will connect to roads around it (or not). This seems to match the approach taken by every print map that I’ve been able to find. However, if you have examples of this extra detail being depicted, I’d be interested to know how they approach the problem while retaining intuitiveness.

@adamfranco
Copy link
Collaborator

Noting for reference: As mentioned in Slack, one styling option for highway=track is the broken double-black line treatment shown as "Uninmproved road" in this example (from #216). This treatment may collide with some treatments of roads under construction in this PR.
Screen Shot 2022-06-09 at 1 56 00 PM

@1ec5
Copy link
Collaborator Author

1ec5 commented Jul 19, 2022

#502 took a different, more workable approach to rendering roads under construction. #503 tracks reviving the localization system in #215 (comment) to implement glosses in labels.

@1ec5 1ec5 closed this Jul 19, 2022
@1ec5 1ec5 deleted the 1ec5-builder-pattern-212 branch July 19, 2022 23:53
@1ec5 1ec5 mentioned this pull request Dec 22, 2022
@1ec5 1ec5 mentioned this pull request Jan 30, 2023
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request highway-lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Roads under construction
4 participants