vue-mapbox icon indicating copy to clipboard operation
vue-mapbox copied to clipboard

Use `sourceLayer` for `{get,set}FeatureState()`

Open thom4parisot opened this issue 5 years ago • 0 comments

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.

image

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

thom4parisot avatar Oct 13 '20 18:10 thom4parisot