I'm working with mapbox and placing several markers on the map. My code looks like this:
add.locations.forEach((location) => {
console.log(location.long + " " + location.lat);
// add marker to map
let marker = new mapboxgl.Marker(el)
.setLngLat([location.long, location.lat])
.setPopup(popup)
.addTo(this.map);
this.markers.push(marker);
});
When I look into the console the console.log(location.long + " " + location.lat); with 2 different long and lat is visible. But on the map only the last location/pointer is there!?