diff --git a/components/MapComponent.js b/components/MapComponent.js
index 25c36b41f..1fa4321c7 100644
--- a/components/MapComponent.js
+++ b/components/MapComponent.js
@@ -686,15 +686,24 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
// Marker hinzufügen für GisStationsStaticDistrict
useEffect(() => {
if (map && GisStationsStaticDistrict.length > 0) {
- // Zuerst alte Marker entfernen
map.eachLayer((layer) => {
if (layer instanceof L.Marker) {
map.removeLayer(layer);
}
});
- // Neue Marker für jede Station hinzufügen
GisStationsStaticDistrict.forEach((station) => {
+ // Alle Status-Objekte mit gleicher IdLD finden
+ const matchingStatuses = GisStationsStatusDistrict.filter(
+ (status) => status.IdLD === station.IdLD
+ );
+ let additionalInfo = "";
+
+ // Alle gefundenen Me-Werte zu einem String hinzufügen
+ matchingStatuses.forEach((status) => {
+ additionalInfo += `
${status.Me} (${status.Na}) `;
+ });
+
const marker = L.marker([station.X, station.Y], {
icon: L.icon({
iconUrl: getIconPath(station.Icon),
@@ -705,27 +714,19 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
}),
}).addTo(map);
- // Popup beim Überfahren mit der Maus öffnen
marker.on("mouseover", function (e) {
this.openPopup();
});
- // Popup schließen, wenn die Maus den Marker verlässt
marker.on("mouseout", function (e) {
this.closePopup();
});
- // Ein Popup mit Informationen zur Station hinzufügen
+
marker
.bindPopup(
- `${station.LD_Name}
${station.Device}
${station.Area_Short} ${station.Area_Name}
${station.Location_Short} ${station.Location_Name}
`
+ `${station.LD_Name}
${station.Device}
${station.Area_Short} ${station.Area_Name}
${station.Location_Short} ${station.Location_Name}${additionalInfo}
`
)
.openPopup();
-
- // Diese Zeile entfernt das automatische Tooltip
- // marker.bindTooltip(station.LD_Name, {
- // permanent: false,
- // direction: "top",
- // });
});
}
}, [map, GisStationsStaticDistrict, GisStationsStatusDistrict]); // Include GisStationsStatusDistrict in dependencies