Repository navigation
Part of geometries missing at tiles borders for MVT #289
Description
Activity
I suspect this is more of a MapServer issue. What version are you using? Do you have a test case?
Thinking about this more - @robrichter, could this be a client/rendering issue? I mean, the MVT file just contains the point coordinate and not the symbol, so the clipping is a rendering artifact. There is an edge buffer used as part of the production - it's set in the MVT output format:
OUTPUTFORMAT NAME "mvt" DRIVER MVT FORMATOPTION "EDGE_BUFFER=20" # default is 10 ENDYou could try bumping that value and see what happens.
--Steve
Problem doesn't seem to be Mapcache related.
Our Mapfile:
OUTPUTFORMAT NAME "mvt" DRIVER MVT MIMETYPE "application/x-protobuf" EXTENSION "pbf" FORMATOPTION "EDGE_BUFFER=20" ENDI tried increasing edge buffer and nothing changed. So I tried to omit Mapcache and request Mapserver directly via
/mapserv?map=mvt.map&LAYERS=reports&MODE=tile&TILEMODE=gmap&TILE=1104+692+11&FORMAT=mvt
The problem remained.I tried changing edge buffer from 0 to 1000 and request the same tile. All created pbf files had the exactly same size. It seems that buffer is ignored. Any idea what am I doing wrong?
I have MapServer version 7.6.4What software is doing the rendering part? It seems that the circle symbol in one tile is rendered correctly but then the adjacent tile is rendered on top of that layer and the the polygon fill paints partly over the symbol.
I do not know how these issues are usually handled on the client side vector tile rendering. The result should be good if all the polygon layers would be rendered first for all tiles, and the POI layer would be painted last.
This issue Leaflet/Leaflet.VectorGrid#149 looks pretty similar.
I cannot read https://github.com/MapServer/MapServer/blob/01d0e7cfb9f92542a578704439edfc713e041d06/mapmvt.c well enough to say if EDGE_BUFFER is also increasing the rectangle that is used to do SELECT with ST_Intersects so that the points which are close to the tile borders get selected into both adjacent tiles. Lines and polygons do not need extended BBOX for selecting, just for clipping.
Is that OpenLayers? We got a report about labels which were cut at the MVT tile boundaries. We noticed that an application that was using MapLibre GL JS was showing labels fine but OpenLayers did not. We could correct the label issue by using an option
"declutter": true. https://openlayers.org/en/latest/apidoc/module-ol_layer_VectorTile-VectorTileLayer.html. Maybe it could help also with symbols.A possible lesson to learn is that because vector tiles are rendered on the client side then also the reason for the rendering issues may be in the client. Of course data can have an effect as well.
Yes, we use OpenLayers. But we also tried T-REX as mvt source with exactly same Postgis data. We used buffer_size=30. Everything worked fine. As I mentioned in my previous post, it seems to me that edge buffer in Mapserver is not working at all for us.
We tried to use option "declutter": true on OpenLayers client and the results are strange. Some points were missing in lower zooms and started to appear when zooming in. And it also badly affected styling. Only some points were styled the rest remained blank, see screenshot below.
You can open the .pbf tile files with QGIS as a plain vector layer (Layer-Add Layer-Add vector layer). Save the two adjacent .pbf tiles on disk and check if the problematic point is included only into one tile. If that is the case you are right with your assumption about edge buffer. You can by the same study if it happens to have some effect on lines and polygons.
I'd like to look into this more but need a test case if possible.
@sdlime Thanks
What do you need to prepare for the test case? I created github repo with mapcache config, mapfile and sql dump. Is that enough?@sdlime Thanks What do you need to prepare for the test case? I created github repo with mapcache config, mapfile and sql dump. Is that enough?
Data is great. A simple client setup would also be helpful - a skeleton OpenLayers page.
There is OL client example
https://codesandbox.io/s/vector-tiles-openlayers-memj5x?file=/main.jsPlease let me know if it is sufficient
Thanks, will try to get that running on a dev box.
@sdlime did you ever have a chance to look at this? I think I am running into the same underlying issue.
I am using MapLibre and I find that points very close to the tile edge completely disappear at intermediate zoom levels.
If I load the same service in QGIS the points are split in half similar to the original example.
I tried patching Mapserver to apply the EDGE_BUFFER during feature selection as well (i.e. duplicating the point between the two adjacent tiles) and this fixes the issue for me.
The fix works regardless of whether the request goes directly to Mapserver or through Mapcache.
See my patched code and example data, mapfile and maplibre html. I can submit a PR to Mapserver if this behaviour is acceptable?

We are serving MVT via Mapcache/Mapserver. Problem is that part of geometires at tiles borders are missing. We tried to use meta_buffer to solve the problem but its not implemented for raw format. Is there some workaround?