Leaflet / Leaflet.VectorGrid

Display gridded vector data (sliced GeoJSON or protobuf vector tiles) in Leaflet 1.0.0
598 stars 194 forks source link

Grid lines visible in geometry #108

Closed wlievens closed 7 years ago

wlievens commented 7 years ago

Grid lines are visible in geometry when using the vector grid sourced from vector tiles. See the attached screenshot and look for the gray vertical and horizontal lines cutting through my geometry.

Is this an issue with the way I am generating my PVT geometry, or does Leaflet VectorGrid render it this way?

gridlines

perliedman commented 7 years ago

I suspect your vector tiles are do not contain any overlap, which can cause this. This is not an inherent behaviour in VectorGrid, as you can see from the examples.

wlievens commented 7 years ago

So you suspect there is something wrong with how I generate the vectors in the backend? Is there supposed to be a small margin for overlap, or what do you mean with the term "overlap"?

perliedman commented 7 years ago

Yes, it is common practice to clip geometries a bit outside the tile's limits, in practice causing a bit of overlap, to avoid rounding problems causing the effect you show.

See https://www.mapbox.com/vector-tiles/specification/#clipping for some discussion of this.

wlievens commented 7 years ago

I assume I should not just hack that in by extending the tile geomrtry (the envelope) as that would screw up how the tiles are aligned. It should probably be some option in the library I use for the backend, so I will explore there. Thanks for the pointers!

wlievens commented 7 years ago

Just updating in case anyone is interested: I've raised this issue (https://github.com/wdtinc/mapbox-vector-tile-java/issues/5) with the backend library (mapbox-vector-tile-java) and its helpful maintainer has resolved the issue and has released a new version.