-
Notifications
You must be signed in to change notification settings - Fork 62
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
Conversation
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. |
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. |
Added fill and casing layers for roads under construction, which are depicted as broken lines.
d33682b
to
e64c573
Compare
Is it planned to display tunnel/bridge status? See say https://zelonewolf.github.io/openstreetmap-americana/#13.72/49.65875/19.90932 tunnel |
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. |
Noting for reference: As mentioned in Slack, one styling option for |
#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. |
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
a35-480p.mov
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 aline-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.