function SetMaker(p, s, nNo) { if (p.length) { IconData.iconUrl = 'https://www.kiilife.jp/image/osm/red-' + nNo + '.png'; var marker = L.marker(p, { icon: L.icon(IconData) }); marker.bindPopup(s); markers.addLayer(marker); if (bounds) { bounds.extend(p); } else { bounds = L.latLngBounds(p); bounds.extend(p); } } } // create a map in the "map" div, set the view to a given place and zoom var bounds; var map = L.map('map', { scrollWheelZoom: false }); var IconData = { iconSize: [24, 42], iconAnchor: [12, 42], popupAnchor: [-0, -40], shadowUrl: 'https://www.kiilife.jp/image/osm/marker-shadow.png', shadowSize: [40, 40], shadowAnchor: [10, 40] }; var markers = L.markerClusterGroup(); var zoom = 0; // add a marker in the given location, attach some popup content to it and open the popup SetMaker([33.7015065, 135.4018158], '障害者支援施設 のぞみ園', 1); SetMaker([33.8058378, 135.38073550000001], '障害者支援施設 第二のぞみ園', 2); SetMaker([33.6967209, 135.40566330000001], 'ホーム宙', 3); SetMaker([33.736046324400654, 135.3769683837891], 'アルファ田辺', 4); SetMaker([33.6967209, 135.40566330000001], 'ホーム翼', 5); SetMaker([33.6913969, 135.39475659999994], 'ホームすばる', 6); SetMaker([33.70300907318518, 135.4018294963165], '日中支援型グループホーム ゆとろぎ', 7); SetMaker([33.70300827240016, 135.40182882922232], '就労継続支援B型 エール作業所', 8); map.addLayer(markers); // add an OpenStreetMap tile layer L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap contributors' }).addTo(map); map.fitBounds(bounds, {paddingTopLeft: [0, 42]}); if (map.getZoom() > 16) { map.setZoom(16); }