From 63a2c7a611bc7a17f8fbd7df5691662d03e16d48 Mon Sep 17 00:00:00 2001 From: Ismail Ali Date: Sun, 21 Apr 2024 15:08:57 +0200 Subject: [PATCH] Show Marker from database --- components/MapComponent.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/components/MapComponent.js b/components/MapComponent.js index 8af733533..a04a9dec8 100644 --- a/components/MapComponent.js +++ b/components/MapComponent.js @@ -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) => {