Search code examples
leafletstylingvector-tiles

Styling Vectorgrid Layer in Leaflet


I'm trying to style a map layer for a leafletJS map and have the following code but it doesn't seem to colour at all:

var vectorTileOptions = {
    rendererFactory: L.canvas.tile,
    vectorTileLayerStyles: {
                            weight: 2,
                            color: 'yellow',
                            },
};

var mapLayer = L.vectorGrid.protobuf("/tiles/admin_countries/{z}/{x}/{y}", vectorTileOptions)

It's just comes renders the standard blue, i'm not sure what i'm doing wrong, any suggestions would be great.


Solution

  • The answer can be found here, by having a click log e.layer to console you can get the property which is used as the key for the vectorTileOptions and then style as appropriate.