I am trying to add another source with a new layer to the map with the type geoJSON on the map (mapbox).
I am getting the error message
ERROR Error: There is already a source with this ID
How can I add another geo-source in typescript with a new map.addSource besides an existing geo-source?
First geo-source:
map.addSource("polygon", create(coordinates, 0.5, 64));
map.addLayer({
"id": "polygon",
"type": "fill",
"source": "polygon",
"layout": {},
"paint": {
'fill-color': {
type: 'identity',
property: 'color',
},
'fill-outline-color': 'rgba(200, 100, 240, 1)',
"fill-opacity": 0.090
}
});
in method:
return {
"type": "geojson",
"data": {
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [ret]
}
}]
}
};
second source:
map.addSource('places', {
'type': 'geojson',
'data': activitiesPlaces
});
var activitiesPlaces = {
'type': 'FeatureCollection',
'features': [
{
'type': 'Feature',
'properties': {
'name': valuesName
},
'geometry': {
'type': 'Point',
'coordinates':
valuesLon,
valuesLat
}
}
]
};
calling this source gives me the error message