2

I'm rendering a MVT (Mapbox Vector Tiles) layer on my Leaflet map. I'm using custom icons to represent my points, so my vector tile options look like this:

var vectorTileOptions = {
maxNativeZoom: 14,
vectorTileLayerStyles: {        
    'vw_meteo_fc': function(properties, zoom) {
        console.log(properties.label);  
        return {
            icon: new L.Icon({
                            iconUrl: 'icons/icon.png',
                            iconSize: [40, 40], // size of the icon
                            iconAnchor: [20, 20], // point of the icon which will correspond to marker's location
                        })                            
        }
    }   
},
interactive: true,  // Make sure that this VectorGrid fires mouse/pointer events
getFeatureId: function(f) {
    return f.properties.osm_id;
}
};

Is there a way to add labels to these points based on feature subproperty? It can be accessed while rendering the point with: properties.label (console logged in code above).

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.