+
+
現在地を表示しています
+
位置情報の取得を許可してください。
+
グループ選択に戻る
-
+ navigator.geolocation.getCurrentPosition(
+ function (pos) {
+ const lat = pos.coords.latitude;
+ const lng = pos.coords.longitude;
+
+ map.flyTo([lat, lng], 17, { duration: 2 });
+
+ const me = { id: 'me', lat: lat, lng: lng };
+ updateMembers([me]);
+
+ // 3秒ごとに他ユーザーの位置取得
+ setInterval(() => {
+ fetch("../mycgi/map1/load_locations.rb?group=" + group)
+ .then(res => res.json())
+ .then(data => {
+ const allUsers = [me, ...data.locations.filter(u => u.id !== 'me')];
+ updateMembers(allUsers);
+ });
+ }, 3000);
+ },
+ function (error) {
+ alert("位置情報が取得できませんでした");
+ }
+ );
+ }
+
+ moveToCurrentLocation();
+