Show Marker from database

This commit is contained in:
2024-04-21 15:08:57 +02:00
parent bba29e04ea
commit 63a2c7a611

View File

@@ -281,14 +281,14 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
}, [mapRef, map]); // Abhängigkeiten prüfen
// Marker hinzufügen von lokale MySQL Datenbank und nicht von APIs
/* useEffect(() => {
useEffect(() => {
// Remove old markers
if (map) {
map.eachLayer((layer) => {
/* map.eachLayer((layer) => {
if (layer instanceof L.Marker) {
map.removeLayer(layer);
}
});
}); */
// Add new markers
locations.forEach((location) => {
@@ -324,7 +324,7 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
marker.addTo(map);
});
}
}, [map, locations, onLocationUpdate]); */
}, [map, locations, onLocationUpdate]);
//------------------------------------------
function parsePoint(pointString) {
@@ -559,11 +559,11 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
// Alte Marker entfernen, indem alle Marker, die durch OMS verwaltet werden, gelöscht werden
oms.clearMarkers();
map.eachLayer((layer) => {
/* map.eachLayer((layer) => {
if (layer instanceof L.Marker) {
map.removeLayer(layer);
}
});
}); */
// Neue Marker für jede Station hinzufügen
GisStationsStaticDistrict.forEach((station) => {