Alex
Alex

Reputation: 41

How to change layout of icon-image on hover in Mapbox?

I use GeoJson Mapbox, and I want to change "icon-image" on hover.

map.addLayer({
"id": "points",
"type": "symbol",
"source": {
    "type": "geojson",
    "data": "geo.json"
},
"layout": {
"icon-image": "icon-1"
});

Any ideas on how to approach this? Thank you.

Upvotes: 2

Views: 1074

Answers (1)

Steve Bennett
Steve Bennett

Reputation: 126045

You can change any layout property, including icon-image, with setLayoutProperty:

map.setLayoutProperty('points', 'icon-image', 'icon-2');

Upvotes: 1

Related Questions