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

North Division Street through Spokane isn't labeled as such #321

Open
Carnildo opened this issue May 12, 2022 · 7 comments
Open

North Division Street through Spokane isn't labeled as such #321

Carnildo opened this issue May 12, 2022 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@Carnildo
Copy link

https://zelonewolf.github.io/openstreetmap-americana/#15.09/47.70128/-117.41106

North Division Street, the main north-south road through Spokane, is not labeled as such anywhere at any zoom level. It has plenty of "US-2" and "US-395" highway shields, but no name.

(Interestingly, I see occasional flashes of what might be a name during transitions as I pan or zoom the map, but nothing permanent.)

@ZeLonewolf ZeLonewolf added the bug Something isn't working label May 12, 2022
@ZeLonewolf
Copy link
Member

I suspect that there is some kind of collision happening here, and I also notice on a few nearby streets that name labels never show up, no matter how close in you zoom. There may also be tile boundaries in play.

Additionally, until onthegomap/planetiler#14 is resolved, the tile server will continue to have fully-spelled out road names, for example "North Division Street" instead of "N Division St". The shorter name labels should help reduce the number of collisions with other objects.

@jleedev jleedev added the maplibre Needs maplibre feature or expertise label Jul 29, 2022
@1ec5
Copy link
Member

1ec5 commented Feb 16, 2023

I suspect that there is some kind of collision happening here, and I also notice on a few nearby streets that name labels never show up, no matter how close in you zoom.

Correct, the issue is that both the road_label and highway-shield layers are using the same default symbol-spacing and text-offset. Both layers are trying to center their symbols on the same coordinates; the highway-shield layer always wins out because it’s on top. Here’s what the street looks like with showCollisionBoxes enabled:

North Division Street

This issue affects many but not all roads. It depends on the visual length of the road name label and that of the concurrent shields when laid out along the road.

@1ec5 1ec5 removed the maplibre Needs maplibre feature or expertise label Feb 16, 2023
@ZeLonewolf
Copy link
Member

@ZeLonewolf
Copy link
Member

This discussion makes me wonder if we actually want to introduce randomness in the standoff distances on labels rather than fully deterministic ones.

@1ec5
Copy link
Member

1ec5 commented Feb 16, 2023

There’s no provision for explicit randomness in expressions – mapbox/mapbox-gl-js#5853 (comment) – let alone any alternation between two symbols of a single geometry in a single layer. If we just want to ensure that a shield and a label are always present when available, then offsetting one of the layers should be enough to ensure that visibility. To avoid a situation where otherwise centered labels would appear uncentered, we could add a redundant label layer with the offset.

@ZeLonewolf
Copy link
Member

There’s no provision for explicit randomness in expressions

This would be a near-trivial thing to add to maplibre-gl-js, and let's not let the lack of expression support limit our thinking. It's an acceptable answer if random offsets isn't the right solution, but I'd prefer to keep the solution space broad as a general rule.

@1ec5
Copy link
Member

1ec5 commented Feb 17, 2023

The lack of a random expression operator isn’t an artificial limitation. The obvious implementation using random() most likely wouldn’t behave as you’d expect, especially when caching is involved.

@1ec5 1ec5 self-assigned this Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants