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 popUpContentDate = "

Inserito il: " + markerData.ts.substring(0, 10) + "
alle " + markerData.ts.substring(11, 16) + "

"; let popUpContent = popUpContentTitle + popUpContentdescription + popUpContentImage + popUpContentDate 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 popUpContentDate = "

Inserito il: " + markerData.ts.substring(0, 10) + "
alle: " + markerData.ts.substring(11, 16) + "

"; //let popUpContentHour = "

" + "alle: " + markerData.ts.substring(11, 16) + "

"; let popUpContent = popUpContentTitle + popUpContentdescription + popUpContentImage + popUpContentDate //+ popUpContentHour marker.bindPopup(popUpContent); if(returnMarker) { return marker; }; } export function createMarkerTemp(markerData, L, map, returnMarker = false){ var marker = L.marker([markerData.coordinate.y, markerData.coordinate.x]).addTo(map); let popUpContentdescription = "

"+ markerData.description +"

"; let popUpContent = popUpContentdescription 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) }