export function initMarkers(markerList, L, map){ markerList.forEach(customMarker => { var marker = L.marker([customMarker.x, customMarker.y]).addTo(map); let popUpContentTitle = "

"+ customMarker.title +"

"; let popUpContentdescription = "

"+ customMarker.description +"

"; let popUpContentImage = ""; let popUpContent = popUpContentTitle + popUpContentdescription + popUpContentImage marker.bindPopup(popUpContent).openPopup(); }); } export function createMarker(markerData, L, map, returnMarker = false){ var marker = L.marker([markerData.coordinate.y, markerData.coordinate.x]).addTo(map); let popUpContentTitle = "

"+ markerData.name +"

"; let popUpContentdescription = "

"+ markerData.description +"

"; let popUpContentImage = ""; let popUpContent = popUpContentTitle + popUpContentdescription + popUpContentImage marker.bindPopup(popUpContent); if(returnMarker) { return marker; }; } export function updateMarkers(markerList, L, map){ var layers = L.LayerGroup(), //layers contains all markers.. contained = []; //makers in map boundingbox layers.eachLayer(function(l) { if( l instanceof L.Marker && map.getBounds().contains(l.getLatLng()) ) contained.push(l); }); console.log(contained) }