Leaflet / Leaflet.VectorGrid

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

Rendering Problem of points #110

Closed bloigge closed 7 years ago

bloigge commented 7 years ago

Hi,

We are using pbfs from a geoserver group-layer, which contains points, lines and polygons. Lines and polygons work as expected but for some reason points don't get rendered properly in border areas when using circle markers or icons.

chrome_2017-07-31_12-11-28

chrome_2017-07-31_12-24-03

I am not sure if this is an issue with geoserver concerning the overlapping margins for each tile or a Leaflet.VectorGrid bug.

bloigge commented 7 years ago

Same issue has been noted here #63 as well

perliedman commented 7 years ago

I suspect this is an issue similar to #108, that is you don't have enough overlap between your tiles, which causes points to only be rendered on one side of the tile boundary.

For rendering to be correct when the symbol would overlap a tile boundary, the point must be present in both of the tiles, and therefore also rendered twice. This becomes especially apparent when working with large symbols.

bloigge commented 7 years ago

Ok thanks for clarification. I already increased the metatile size and the extra pixel border in the geoserver grouplayer settings but unfortunately it doesn't work. As a workaround I changed the the icon size to be very small. I am not sure how mapbox-gl works under the hood, but using the same source didn't create this behavior there: chrome_2017-08-01_11-45-09

perliedman commented 7 years ago

Hm, that is weird. Regarding how Mapbox GL works, you can get the general idea by reading the vector tile spec's section on clipping, if you haven't already: https://www.mapbox.com/vector-tiles/specification/#clipping

TroySchmidt commented 6 years ago

For someone else finding this and looking for better direction, add buffer parameter to your options object you pass to L.vectorGrid.slicer. I set mine to 500 and now it is working as I would expect.

 const slicerStyle = {
      buffer: 500,
      pane: 'dynamics',
      maxZoom: 20,
      vectorTileLayerStyles: {
        sliced: () => {
          return {
            icon: new L.Icon()
          };
        }
      }
    };

    this.graphicsLayer =  L.vectorGrid.slicer(targetFeatures, slicerStyle).addTo(this.map);
mngyng commented 5 years ago

See #149. Sounds like the same issue. The buffer option didn't work for me, so I changed the query to add a buffer for points on the tile edge.