diff --git a/map4.js b/map4.js index 6bf1f4e..d4f1cf0 100644 --- a/map4.js +++ b/map4.js @@ -648,18 +648,14 @@ nearestDist = d; } - // 通常駅ピン - const mk = L.marker([st.lat, st.lon]).addTo(map); - mk.bindPopup(cleanName + "駅"); // ← 表示は必ず「◯◯駅」 - stationMarkers.push(mk); + // エレベーター有無でピンを切り替え(1つだけ立てる) +const isEV = elevatorInfo.get(cleanName); +const icon = isEV ? elevatorIcon : null; // null → Leaflet標準ピン(青) - // EVピン(CSV一致した駅) - if (elevatorInfo.get(cleanName)) { - const ev = L.marker([st.lat, st.lon], { icon: elevatorIcon }) - .addTo(map) - .bindPopup(`${cleanName}駅:エレベーターあり`); - stationMarkers.push(ev); - } +const mk = L.marker([st.lat, st.lon], icon ? { icon } : {}).addTo(map); +mk.bindPopup(isEV ? `${cleanName}駅(エレベーターあり)` : `${cleanName}駅`); +stationMarkers.push(mk); + }); // --------------------- // ★ forEach 正しく閉じる