diff --git a/map/gps/kadai.js b/map/gps/kadai.js index 09f194a..c57a3c9 100644 --- a/map/gps/kadai.js +++ b/map/gps/kadai.js @@ -1,21 +1,22 @@ document.addEventListener("DOMContentLoaded", () => { -var koeki = L.map("gpsmap").setView([38.88272548443688,139.83696833252904], 16); -L.tileLayer( - 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', - {attribution: - '© OpenStreetMap contributors' + var koeki = L.map("gpsmap").setView([38.88272548443688,139.83696833252904], 16); + L.tileLayer('https://{s}.tile.osm.org/{z}/{x}/{y}.png', { + attribution: + '© OpenStreetMap \ + contributors' }).addTo(koeki); - var gpsmarker = L.marker(koeki.getCenter()).addTo(koeki); - gpsmarker.bindPopup("startを押してください").openPopup(); - + + var gpsmarker = L.marker(kouki.getCenter()).addTo(koeki); + gpsmarker.bindPopup("STARTおしてね").openPopup(); + var nTrial = 100 var watchId = null; // 最初はnullにしておく function stopGPS() { // watchが動いていたら止めてnullにする console.log("watchId="+watchId); - if (watchId != null) { // nullかどうかで比較しないとだめ(初期値0) + if (watchId !== null) { // nullかどうかで比較しないとだめ(初期値0) navigator.geolocation.clearWatch(watchId); document.getElementById("title").textContent = "stop"; - gpsmarker.setPopupContent("GPSを止めました"); + gpsmarker.setPopupContent("停めました"); } watchId = null; } @@ -26,7 +27,7 @@ maximumAge: 0, timeout: 3000, enableHighAccuracy: true}); document.getElementById("title").textContent = "START!!"; } -function onSuccess(pos) { // GPS信号が取れたらここに来る + function onSuccess(pos) { // GPS信号が取れたらここに来る var latlng = L.latLng([pos.coords.latitude, pos.coords.longitude]); mymap.panTo(latlng);// 地図の中心をそこにする console.log(latlng);