Leaflet / Leaflet.VectorGrid

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

fillOpacity and fillColor have no effect when rendering circlemarkers #279

Open slutske22 opened 1 year ago

slutske22 commented 1 year ago

When rendering point geometries, regardless of passing in fillOpacity and fillColor to the vectorTileLayerStyles function, it seems to render the points as circlemarkers with no fill at all:

Screen Shot 2023-01-04 at 3 32 31 PM

The code to get this follows the docs pretty closely:

  L.vectorGrid
    .slicer(geoJsonGoeshere, {
      rendererFactory: L.canvas.tile,
      vectorTileLayerStyles: {
        sliced: function (properties, zoom) {
          return {
            radius: 5,
            color: properties.daqi.color,
            fillOpacity: 1,
            fillColor: properties.daqi.color
          };
        }
      }
    })
    .addTo(map);

Sandbox demonstrating the issue

Is this a known bug? Am I doing something wrong? This seems to be the case for both canvas and svg renderers.

abreufilho commented 1 year ago

I know it has some time, but try:

L.vectorGrid
    .slicer(geoJsonGoeshere, {
      rendererFactory: L.canvas.tile,
      vectorTileLayerStyles: {
        sliced: function (properties, zoom) {
          return {
            fill:true,
            radius: 5,
            color: properties.daqi.color,
            fillOpacity: 1,
            fillColor: properties.daqi.color
          };
        }
      }
    })
    .addTo(map);