diff --git a/components/MapComponent.js b/components/MapComponent.js
index 1679180f9..c427186c3 100644
--- a/components/MapComponent.js
+++ b/components/MapComponent.js
@@ -68,11 +68,11 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
useEffect(() => {
if (map && GisStationsStaticDistrict.length > 0) {
// Zuerst alte Marker entfernen
- 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) => {
@@ -91,6 +91,10 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
marker
.bindPopup(`${station.LD_Name}
${station.Device}`)
.openPopup();
+ marker.bindTooltip(station.LD_Name, {
+ permanent: false,
+ direction: "top",
+ });
});
}
}, [map, GisStationsStaticDistrict]); // Abhängigkeiten hinzufügen, um sicherzustellen, dass Effekt bei Änderungen neu ausgeführt wird
@@ -274,6 +278,10 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
marker.bindPopup(
`${location.description || "Unbekannt"}
Type: ${location.idPoiTyp || "N/A"}
Lat: ${latitude.toFixed(5)}, Lng: ${longitude.toFixed(5)}`
);
+ marker.bindTooltip(location.description, {
+ permanent: false,
+ direction: "top",
+ });
marker.on("dragend", function (e) {
const newLat = e.target.getLatLng().lat;