[Geoserver-devel] vectortiles plugin clips at the wrong place

Hi all,

I am trying to use Geoserver as a mapbox vector tile (MT) provider. I have looked into Stefan Henneberger's gs-mvt extension [1] and he pointed me to the community plugin vectortiles [2]. The MVT specification works because it uses a small buffer around the tile to clip the geometries, this is very important otherwise when rendering the geometries in the browser, the tile-edges get rendered as well (since they are now integral part of the clipped geometries.

The gs-mvt extension solves this by using a custom WMS parameter 'BUFFER' and it uses that parameter to clip the geometries.

The vectortiles plugin uses the VectorTileEncoder class by ElectronicChartCentre [3] which has its own default polygonClipBuffer. However the plugin clips the geometries at MapBounds [4] before sending them over to the encoder, rendering the whole polygonClipBuffer useless. Since the VectorTileEncoder has the correct (buffered) clipping method, I believe the PipelineBuilder should leave the geometries alone and let the VectorTileEncoder do the clipping. As such I think clipToMapBounds property should be set to 'false'. I tested this and the resulting tiles correspond in size with the ones generated by gs-mvt and rendered in ol3 they no longer show tile boundaries.

See PR: https://github.com/geoserver/geoserver/pull/1452

Regards,
Steven

[1] https://github.com/stefan0722/gs-mvt
[2] https://github.com/geoserver/geoserver/tree/master/src/community/vectortiles
[3] https://github.com/ElectronicChartCentre/java-vector-tile/blob/master/src/main/java/no/ecc/vectortile/VectorTileEncoder.java
[4] https://github.com/geoserver/geoserver/blob/master/src/community/vectortiles/src/main/java/org/geoserver/wms/vector/PipelineBuilder.java#L233
[5] https://github.com/geoserver/geoserver/blob/ea977c6327fc209e6de92516534ff3457c2d921e/src/community/vectortiles/src/main/resources/applicationContext.xml#L59