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

Map readability issue due to label collisions between layers #64

Open
varette opened this issue Sep 15, 2023 · 3 comments
Open

Map readability issue due to label collisions between layers #64

varette opened this issue Sep 15, 2023 · 3 comments

Comments

@varette
Copy link

varette commented Sep 15, 2023

Hello! Although this project is definitely the best way to visualize OSM indoor map data, I find that for map data with odd shapes or gaps in them, the display can get quite cluttered by labels from base layers which overlap with the indoor geometry. Although those labels are underneath the indoor map, and they don't collide with labels on the indoor symbol layer, it still adds noise that makes comprehending the map more difficult. Some examples:

U Hamburg Hauptbahnhof Süd image

Obviously maplibre's label placement only takes other labels into account and not geometry, which means that any part of a room that is not covered by a symbol is at risk of having this clutter at its edges.

I'm wondering if there would be a way to make the labels of a specific layer avoid the geometry of another layer.

@varette
Copy link
Author

varette commented Sep 16, 2023

I've done a bit of research and found that while the symbol collision detection system doesn't support arbitrary geometry, it's possible to work around this by adding invisible symbols to the map that approximate the shape of the geometry.

This might sound like a hack, but given that the system only supports rectangles and circles, this is exactly how the original implementer proposes supporting arbitrary geometry:

Using multiple circles allows us to approximate arbitrary line geometries (and in fact there are outstanding feature requests that would require us to support other arbitrary collision geometries such as “don’t let labels get drawn over this lake” — we would probably implement support by converting those geometries into circles first).

@francois2metz
Copy link
Member

Hi @varette
Sorry for the delay! This problem is quite tricky indeed. Not sure how your hack could solve the issue. Maybe displaying the indoor=level geometry may solve this. I need to take a look.

@varette
Copy link
Author

varette commented Nov 6, 2023

Nothing to worry about, I'm just thinking about ways to improve the map out of personal interest, since I'd love to see indoor maps become a standard feature in OSM apps.

You're right that my solution wouldn't help, so I've had a different idea. We can use a filter layer and the "within" statement to filter out POIs within an arbitrary feature collection's geometry. So if we build a polygon that bounds the indoor geometry plus some buffer, then we can use it to filter out most of the POIs which are overlapping the indoor layer.

I've implement a prototype of this (source), and it seems like it could work. It's a rough experiment, there's probably a much more efficient way to build a bounding polygon. Right now I build the filtering polygons by running the level's geometry through turf's "buffer", "simplify, then "union".

Here's a comparison:
U Hamburg Hauptbahnhof Südwith my patch

And a large view to show the surroundings
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants