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.73358377496269, 135.39430618286136], 'ニチイケアセンター新万', 1);
SetMaker([33.6779852, 135.34764240000004], 'ニチイケアセンター白浜', 2);
SetMaker([33.8802131, 135.46958819999998], 'ニチイケアセンター龍神', 3);
SetMaker([33.73986492069774, 135.37117481231692], 'ニチイケアセンター田辺', 4);
SetMaker([33.894256, 135.488065], 'ニチイケアセンター紀中たなべ', 5);
SetMaker([33.7091645, 135.98613279999995], 'ニチイケアセンター新宮', 6);
SetMaker([33.69416806586785, 135.4184508061261], 'ニチイケアセンターかみとんだ', 7);
SetMaker([33.6842629929122, 135.96996959174828], 'ニチイケアセンター紀南', 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);
}