versatiles-org / versatiles-style

create map styles
Other
38 stars 4 forks source link

Some bridges ordering above roads #28

Open RyanTG opened 1 month ago

RyanTG commented 1 month ago

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 commented 1 week ago

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

yetzt commented 1 week ago

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 commented 1 week ago

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 commented 1 week ago

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.