Skip to content

Filter not working with L.VectorGrid.Protobuf 🔴  #285

@geekypradip

Description

@geekypradip

I'm currently working with Leaflet's VectorGrid and I'm encountering an issue with the filter option. Here's a snippet of my code:

const vectorGrid = L.vectorGrid.protobuf(url, {
      vectorTileLayerStyles: vectorTileLayerStyles as Record<
        string,
        PathOptions
      >,
      rendererFactory: L.svg.tile,
      maxNativeZoom: 28,
      maxZoom: 28,
      interactive: true,
      fetchOptions: {headers: {Authorization: `Bearer ${token}`}},
      bounds: bounds,
      zIndex: 1000,
      filter: (properties, zoom) => {
        console.log(properties, zoom);
        return false;
      },
    });

In the above code, I've provided a filter function that should prevent any feature from being rendered on the map, as I'm returning false. However, it seems like the filter function is not being called at all. I've tried to debug this using Chrome's devtools and added a console.log statement inside the filter function, but it's not printing anything.

The strange thing is, whether I pass the filter option or not, the result is the same. It's as if the filter function is being completely ignored.

Any help or guidance on this issue would be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions