I am using Mapbox GL JS to display a lot of pins on a map with custom marker image:
map.on('load', function () {
map.loadImage("/path/to/pin1.png", function(error, image) {
if (error) throw error;
map.addImage("custom-marker", image);
});
map.addLayer({
id: "unclustered-point",
source: "geolocations",
filter: ["!", ["has", "point_count"]],
type: "symbol",
layout: {
"icon-image": "custom-marker",
"icon-allow-overlap": true,
"icon-anchor": "bottom",
"icon-size": 0.5
}
});
//...
});
Is there any way to change a single marker image programmatically (e.g. the clicked marker)?
"feature-state" data expressions are not supported with layout properties.- nagyadrian