I’m loading and adding my icons to my map ( i’m using react map gl ) but when i switch to satellite view ( henceforth changing my style ) my icons ( my symbol layer ) just disapear !
I have tried loading and adding my icons again with parameter onStyleLoad unsuccesfully.
Here is my maps props
return (
<div>
<div className="grande-carte-div">
<ReactMapGL
onLoad={handleMapLoad}
onStyleLoad={handleMapLoad}
{...props.viewport}
mapStyle={mapboxStyles[mapboxStyleIndex]}
mapboxAccessToken="pk.mytoken"
ref={mapRef}
and my function to add and load icons ( icons that disapear when i switch style…)
const handleMapLoad = (event) => {
const map = event.target;
// Load image when map loads
map.loadImage(Danger, (error, image) => {
if (error) throw error;
map.addImage('danger-icon', image);
});
map.loadImage(Jams, (error, image) => {
if (error) throw error;
map.addImage('commute-icon', image);
});
map.loadImage(Closed, (error, image) => {
if (error) throw error;
map.addImage('closed-icon', image);
});
map.loadImage(Accident, (error, image) => {
if (error) throw error;
map.addImage('accident-icon', image);
});
};
Does anyone know why mapbox is considering my symbol layer as part of the style ?