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

Tile pixel clipping underestimates road features causing discontinuities #4685

Open
alasram opened this issue Sep 9, 2024 · 3 comments
Open
Labels
enhancement New feature or request PR is more than welcomed Extra attention is needed

Comments

@alasram
Copy link

alasram commented Sep 9, 2024

When polylines are renderer, i.e roads, the thickness of the line is not considered when clipping pixels outside the tile. This can lead to discontinuities of lines across tiles when the polyline data does not have enough buffer outside the tile.
In this example polyline data has vertices within the tile (the last vertex is at the tile boundary but not beyond) and this causes the following discontinuity:

3_rd_final_result

The following shows what happens when a first tile is rendered:

1_rd_first_tile

The green pixels are retained while the red ones are outside the tile and are therefore discarded.

The following shows what happens when second tile is rendered:

2_rd_second_tile

For more context this is the wireframe geometry of the rendered road in the second tile:

4_rd_tri_mesh

The issue hasn't been encountered so far because most data has a buffer around the tile. The buffer size depends on the road thickness which is defined in the style and is not part of the MVT data. For robustness MapLibre should not rely on a buffer large enough to avoid this issue. Instead MapLibre should gather the data from adjacent tiles and extend the geometry based on thickness. Alternatively the renderer should be aware of adjacent tiles (This is maybe not trivial).

This issue exists in both MapLibre-Native and MapLibre-GL-JS. The same MapLibre-Native issue is here

@HarelM
Copy link
Collaborator

HarelM commented Sep 10, 2024

Maplibre assumes there is a tile boundary, this is needed for a lot of reasons, namely for rendering areas.
I'm not sure I agree with the statements here about not relaying on the fact that tiles has "padding".
Can you better explain the problem here? Why can't you use tiles with "padding"?

@HarelM HarelM added the need more info Further information is requested label Sep 10, 2024
@alasram
Copy link
Author

alasram commented Sep 10, 2024

I have MVT data without boundaries and is therefore incompatible with MabLibre if boundaries are part of the requirements. How much boundary is required also depends on the style: If the data has extra 8 units but in the style I set the road size to be more than 8 units then I'll hit this issue. MapLibre should at least throw a warning about compatibility if such case occurs

@HarelM
Copy link
Collaborator

HarelM commented Sep 10, 2024

True, how much boundary is usually configured in the tile creation process, and you should tweak it according to your style.
Feel free to simply a PR with the relevant check and the relevant warning.

@HarelM HarelM added enhancement New feature or request PR is more than welcomed Extra attention is needed and removed need more info Further information is requested labels Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PR is more than welcomed Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants