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

Some bridges ordering above roads #28

Closed
RyanTG opened this issue Oct 2, 2024 · 5 comments
Closed

Some bridges ordering above roads #28

RyanTG opened this issue Oct 2, 2024 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@RyanTG
Copy link

RyanTG commented Oct 2, 2024

I'm not sure if I'm describing this correctly. But what I think I'm seeing are bridges ordered above roads, like in the screenshot below:

image

As you can see, there are also bridges on the right, and they are not exhibiting this behavior. Current example area https://maplibre.org/maputnik/?layer=3839061778%7E0#17.77/34.152323/-118.28118

There are lots of examples like this nearby. Such as: https://maplibre.org/maputnik/?layer=3839061778%7E0#15.71/34.101601/-118.251148
I'm only noticing it on motorways.

Across all the styles on maputnik, I'm only seeing this on versatiles.

@MichaelKreil
Copy link
Member

That's a really good head-scratcher...
any idea @yetzt ?

@MichaelKreil MichaelKreil added the help wanted Extra attention is needed label Nov 15, 2024
@yetzt
Copy link
Member

yetzt commented Nov 15, 2024

multi-level-bridges are tricky. the bit that is obscured by the bridge is not tagged as a bridge and therefore below the bridge-area.

other styles first paint all the bridge areas and then all the streets (that are not tunnels) making roads that in reality pass under bridges visually pass over them, as you can see with the Golden State Freeway in the example area.

Golden State Freeway visually passing over a bridge in goes under in reality

this is a pretty common tagging mistake and trying to "fix it in post" with the style leads to other problems.

if you want to do so, you can move the bridge style definition to right after the tunnel-* styles to paint bridge areas below all surface streets as it is done in other map styles:

paint surface roads under bridges paint surface roads above bridges

also, the basic, lean, general-purpose shortbread does not include the level property for bridges and streets that are bridges, so at the moment it's not possible to order the layery by that.

see also: maplibre/maplibre-gl-js#2108

@MichaelKreil
Copy link
Member

Shortbread does some stuff with the numeric layer attribute, e.g. sorting polygons of bridges and streets by layer.
Can we use that somehow?
Or do we have to improve Shortbread?

@yetzt
Copy link
Member

yetzt commented Nov 15, 2024

this is complex. shortbread having the layer property for streets and bridges would open up possibilities. although it would bloat up the style since all styles for streets and bridges would need to be defined for every possible layer to achieve correct stacking, given the limitations of the map style definition. furthermore all the bridge and steet geometries in osm have to be tagged correctly; the layer property is not consistantly used and often inconsistant with the streets.

there is a workaround for this by defining a lot of the style in the tiles itself, this would however require a very different map scheme and is only applicable when using street linestrings only with no bridge area polygons.

a lot of the difficulties stem from mixing the streets and bridges layers; maplibre has provisions to sort features within a layer in the frontend, but streets are linestrings and bridges are polygons, so this approach can't be used when using the bridges layer in between streets by level.

one approach would be to ignore the bridge polygons in the layering (eg draw them below all streets that are not tunnels, as is common in other styles) and draw another, wider version of the street linestring for bridges (in addition to the street itself and the casing) to simulate a bridge polygon that is in the correct order. if sthe streets are indeed ordered by level in the tiles this should yield a usable result without bloating up the generated styles too much.

@yetzt
Copy link
Member

yetzt commented Dec 9, 2024

i've implemented this in bf56eff, feedback welcome.

@yetzt yetzt closed this as completed Dec 10, 2024
@github-project-automation github-project-automation bot moved this to Done in Overview Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
Status: Done
Development

No branches or pull requests

3 participants