/* 北緯38.891度, 東経139.824度, ズームレベル16 で地図表示 */ var mymap = L.map("hogemap").setView([38.891, 139.824], 16); L.tileLayer('//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' }).addTo(mymap); L.control.scale().addTo(mymap); // クリック位置にマーカーを追加 mymap.on("click", (e) => { var maru = L.circle(e.latlng, 20); //まず変数に保存 setTimeout(() => {maru.remove();}, 3000); //3000ミリ秒経ったら消す maru.addTo(mymap); var newh1 = "北緯" + e.latlng.lat + ", 東経"+e.latlng.lng; document.getElementById("latlng").textContent = newh1; });