vue-mapbox
vue-mapbox copied to clipboard
Use `sourceLayer` for `{get,set}FeatureState()`
As stated in Mapbox-GL documentation https://docs.mapbox.com/mapbox-gl-js/api/map/#map#setfeaturestate.
I get an Error: The sourceLayer parameter must be provided for vector source types. otherwise.
This is the example from the very same documentation linked above:
// When the mouse moves over the `my-layer` layer, update
// the feature state for the feature under the mouse
map.on('mousemove', 'my-layer', function(e) {
if (e.features.length > 0) {
map.setFeatureState({
source: 'my-source',
sourceLayer: 'my-source-layer',
id: e.features[0].id,
}, {
hover: true
});
}
});
refs entrepreneur-interet-general/CartoBio-Presentation#70