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

Incorrect Tile Rendering at Higher Zoom Levels Due to Buffer Size #90

Open
FabianRechsteiner opened this issue Nov 14, 2024 · 5 comments

Comments

@FabianRechsteiner
Copy link

Description:
At higher zoom levels on our map at https://stadtplantest.winterthur.ch/basemapav/, some vector tiles are incorrectly rendered. In the browser console, I receive the following warning:
Geometry exceeds allowed extent, reduce your vector tile buffer size

Investigation:
Upon reviewing the documentation, I found the parameter buffer_size which controls the tile buffer in pixels:

buffer_size u32 (optional): Tile buffer size in pixels (None: no clipping)

Question:

  • How should the buffer_size parameter be correctly configured to resolve this issue?
  • What is the optimal buffer_size to ensure proper rendering without overloading the tiles?
  • Do I need to define the buffer_size for each individual layer in my tileset?
@pka
Copy link
Contributor

pka commented Nov 14, 2024

The buffer_size has to be defined for each layer. The value depends on the used styles. If the style has a border line witdh of 5 for a polygon layer, then buffer_size should also be 5. For line layers it's half of the line witdh.

@FabianRechsteiner
Copy link
Author

Solution:
I managed to solve the issue by configuring the buffer_size parameter as follows:

YAML
Code kopieren
[[tileset.postgis.layer]]
name = "av_bb_boflaeche"
table_name = "public.av_bb_boflaeche"
minzoom = 15
maxzoom = 24
geometry_type = "POLYGON"
geometry_field = "geom"
fid_field = "fid"
srid = 2056
buffer_size = 256
I found useful information about buffer_size in this article: Tile Buffer Size.

What do you think about buffer_size = 256?

@pka
Copy link
Contributor

pka commented Nov 15, 2024

Large buffer_sizes make tiles bigger, so they make only sense if the style is not known in advance.

@FabianRechsteiner
Copy link
Author

Thanks for the information.

I've noticed that when I define the buffer_size parameter, objects near the tile edges get clipped.

For example, with buffer_size = 5:

Image 1: buffer_size = 5

buffer_size 5

Image 2: No buffer_size

No buffer_size

This is not ideal, so I decided to omit the buffer_size parameter entirely.

Additionally, I noticed that this issue only occurs in the MapLibre web map and not in QGIS, which suggests that the problem might lie elsewhere.

@pka
Copy link
Contributor

pka commented Nov 15, 2024

Objects spread over multiple tiles are a common problem of vector tiles. One solution is to add a feature ID und use that for feature selections, the other one is avoiding clipping. Most of the time you want clipping, but there are use cases like this one when you want to disable it. Maybe we should have a spearate configuration for clipping to make it independent from buffer_size

QGIS reads vector tiles like regular vector geometry sources using the GDAL driver and renders them like other sources, which can result in major differences to MapLibre GL.

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