質問編集履歴

4

質問内容の復元

2017/01/13 04:15

投稿

退会済みユーザー
test CHANGED
@@ -1 +1 @@
1
- googlemap表示 
1
+ googlemap表示 スマホで表示されない
test CHANGED
@@ -1,11 +1,203 @@
1
- ###実現したいこと
1
+ 下記のプログラムをデバックしたらgooglemapが表示されるのは、PC上で確認できましたが、デスクトップPCのため位置の移動ができなので、位置情報および移動した場所の線の書き出しの動作の確認ができません。最終的には、スマートフォンおよびiphoneでのを試みたいのですが、スマートフォンおよびiphoneで起動した場合、マップが表示されません。お力添えよろしくお願いいたします。
2
-
3
- mapの表示
4
-
5
-
6
-
7
-
8
2
 
9
3
  ###発生している問題・エラーメッセージ
10
4
 
5
+ /*プログラム内容*/
6
+
7
+ 定期的に取得した位置情報をgooglemap上に線でつなげ表示(移動経路の記録)
8
+
9
+ ```
10
+
11
+ <!DOCTYPE HTML>
12
+
13
+ <html lang="ja">
14
+
15
+ <meta charset="UTF-8"></meta>
16
+
17
+ <head><title>sample</title>
18
+
19
+ <style type-"text/css">
20
+
21
+ #map_wrap { width: 100%; max-width: 600px; }
22
+
23
+ #position { padding: 8px; background-color: #CDE; }
24
+
25
+ #position span { padding-left: 1em; font-size: 90%; }
26
+
27
+ #map { width: 100%; height: 500px; }
28
+
29
+ #contorol button { width: 6em; text-align: center; }
30
+
31
+ #contorol button:last-child { float: right; }
32
+
33
+ </style>
34
+
35
+ <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
36
+
37
+ </head>
38
+
39
+ <body>
40
+
41
+ <div id="map_wrap">
42
+
43
+ <div id="position">現在位置:
44
+
45
+ <span>*** 停止中 ***</span>
46
+
47
+ </div>
48
+
49
+ <div id="map">google map</div>
50
+
51
+ <div id="contorol">
52
+
53
+ <button type="button">START</button>
54
+
55
+ <button type="button">STOP</button>
56
+
57
+ </div>
58
+
59
+ </div>
60
+
61
+ <script type="text/javascript">
62
+
63
+ var Tracker = (function(){
64
+
65
+ // *** 初期設定・準備処理 ***
66
+
67
+ var minInterval = 1000; // 情報取得の最少間隔(単位 msec)
68
+
69
+ var Locator = navigator.geolocation;
70
+
71
+ var watchID = null;
72
+
73
+ var MapElement = document.getElementById("map");
74
+
75
+ var PositionDisp = document.querySelector("#position span");
76
+
77
+ // マップ 設定
78
+
79
+ var map = new google.maps.Map( MapElement, { zoom: 15 });
80
+
81
+ // ポリライン インスタンス作成
82
+
83
+ var PolyLine = new google.maps.Polyline({
84
+
85
+ strokeColor: '#A22', strokeOpacity: 0.55, strokeWeight: 4, map: map
86
+
87
+ });
88
+
89
+ // マーカー インスタンス作成
90
+
91
+ var Markers = createMarker();
92
+
93
+ function createMarker(){
94
+
95
+ var iconURL = "http://labs.google.com/ridefinder/images/";
96
+
97
+ var icon1 = new google.maps.Marker({
98
+
99
+ icon: iconURL + "mm_20_blue.png", map: map, zIndex: 10
100
+
101
+ });
102
+
103
+ var icon2 = new google.maps.Marker({
104
+
105
+ icon: iconURL + "mm_20_red.png", map: map, zIndex: 12
106
+
107
+ });
108
+
109
+ return { start: icon1, current: icon2 }
110
+
111
+ }
112
+
113
+ // マップ・マーカーの初期表示
114
+
115
+ var resetMap = function(){
116
+
117
+ watchTime = new Date();
118
+
119
+ Locator.getCurrentPosition(function(p){
120
+
121
+ var pos = { lat: p.coords.latitude, lng: p.coords.longitude };
122
+
123
+ map.setCenter(pos);
124
+
125
+ Markers.current.setPosition(pos);
126
+
127
+ Markers.start.setPosition(pos);
128
+
129
+ PolyLine.setPath([new google.maps.LatLng(pos)]);
130
+
131
+ });
132
+
133
+ }
134
+
135
+ // watchPositionイベント処理
136
+
137
+ var watchHandler = function(p){
138
+
139
+ if((new Date()) - watchTime < minInterval) return;
140
+
141
+ watchTime = new Date();
142
+
143
+ var pos = { lat: p.coords.latitude, lng: p.coords.longitude };
144
+
145
+ map.setCenter(pos);
146
+
147
+ Markers.current.setPosition(pos);
148
+
149
+ PolyLine.getPath().push(new google.maps.LatLng(pos));
150
+
151
+ PositionDisp.innerHTML = "緯度 " + pos.lat + " / 経度 " + pos.lng;
152
+
153
+ }
154
+
155
+ // *** 追跡用オブジェクト ***
156
+
157
+ var tracker = {
158
+
159
+ start: function(){
160
+
161
+ if(watchID) return;
162
+
163
+ resetMap();
164
+
165
+ PositionDisp.innerHTML = "*** 受信中 ***";
166
+
167
+ watchID = Locator.watchPosition(watchHandler);
168
+
169
+ },
170
+
171
+ stop: function(){
172
+
173
+ Locator.clearWatch(watchID);
174
+
175
+ PositionDisp.innerHTML = "*** 停止中 ***";
176
+
11
- getcorrentbiid?
177
+ watchID = null;
178
+
179
+ }
180
+
181
+ };
182
+
183
+ resetMap();
184
+
185
+ return tracker;
186
+
187
+ })();
188
+
189
+ // ボタンへのイベント設定
190
+
191
+ var buttons = document.querySelectorAll("#contorol button");
192
+
193
+ google.maps.event.addDomListener(buttons[0], "click", Tracker.start);
194
+
195
+ google.maps.event.addDomListener(buttons[1], "click", Tracker.stop);
196
+
197
+ </script>
198
+
199
+ </body>
200
+
201
+ </html>
202
+
203
+ ```

3

質問内容が変わった

2017/01/13 04:15

投稿

退会済みユーザー
test CHANGED
@@ -1 +1 @@
1
- googlemap表示 スマホで表示されない
1
+ googlemap表示 
test CHANGED
@@ -1,6 +1,6 @@
1
1
  ###実現したいこと
2
2
 
3
- 下記のプログラムをデバックしたらgooglemapが表示されるは、PC上で確認できましたが、デスクトップPCのため位置の移動ができないので、位置情報および移動した場所の線の書き出しの動作の確認ができません。最終的には、スマートフォンおよびiphoneでのを試みたいのですが、スマートフォンおよびiphoneで起動した場合、マップが表示されません。お力添えよろしくお願いいたします。
3
+ mapの表示
4
4
 
5
5
 
6
6
 
@@ -8,242 +8,4 @@
8
8
 
9
9
  ###発生している問題・エラーメッセージ
10
10
 
11
- /*プログラム内容*/
12
-
13
- 定期的に取得した位置情報をgooglemap上に線でつなげ表示(移動経路の記録)
14
-
15
- ```
16
-
17
- <!DOCTYPE HTML>
18
-
19
- <html lang="ja">
20
-
21
- <meta charset="UTF-8"></meta>
22
-
23
- <head><title>sample</title>
24
-
25
-
26
-
27
- <style type-"text/css">
28
-
29
- #map_wrap { width: 100%; max-width: 600px; }
30
-
31
- #position { padding: 8px; background-color: #CDE; }
32
-
33
- #position span { padding-left: 1em; font-size: 90%; }
34
-
35
- #map { width: 100%; height: 500px; }
36
-
37
- #contorol button { width: 6em; text-align: center; }
38
-
39
- #contorol button:last-child { float: right; }
40
-
41
- </style>
42
-
43
-
44
-
45
- <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
46
-
47
-
48
-
49
- </head>
50
-
51
- <body>
52
-
53
- <div id="map_wrap">
54
-
55
- <div id="position">現在位置:
56
-
57
- <span>*** 停止中 ***</span>
58
-
59
- </div>
60
-
61
-
62
-
63
- <div id="map">google map</div>
64
-
65
-
66
-
67
- <div id="contorol">
68
-
69
- <button type="button">START</button>
70
-
71
- <button type="button">STOP</button>
72
-
73
- </div>
74
-
75
- </div>
76
-
77
-
78
-
79
-
80
-
81
- <script type="text/javascript">
82
-
83
- var Tracker = (function(){
84
-
85
-
86
-
87
- // *** 初期設定・準備処理 ***
88
-
89
-
90
-
91
- var minInterval = 1000; // 情報取得の最少間隔(単位 msec)
92
-
93
- var Locator = navigator.geolocation;
94
-
95
- var watchID = null;
96
-
97
- var MapElement = document.getElementById("map");
98
-
99
- var PositionDisp = document.querySelector("#position span");
100
-
101
-
102
-
103
- // マップ 設定
104
-
105
- var map = new google.maps.Map( MapElement, { zoom: 15 });
106
-
107
- // ポリライン インスタンス作成
108
-
109
- var PolyLine = new google.maps.Polyline({
110
-
111
- strokeColor: '#A22', strokeOpacity: 0.55, strokeWeight: 4, map: map
112
-
113
- });
114
-
115
-
116
-
117
- // マーカー インスタンス作成
118
-
119
- var Markers = createMarker();
120
-
121
- function createMarker(){
122
-
123
- var iconURL = "http://labs.google.com/ridefinder/images/";
124
-
125
- var icon1 = new google.maps.Marker({
126
-
127
- icon: iconURL + "mm_20_blue.png", map: map, zIndex: 10
128
-
129
- });
130
-
131
- var icon2 = new google.maps.Marker({
132
-
133
- icon: iconURL + "mm_20_red.png", map: map, zIndex: 12
134
-
135
- });
136
-
137
- return { start: icon1, current: icon2 }
138
-
139
- }
140
-
141
-
142
-
143
-
144
-
145
- // マップ・マーカーの初期表示
146
-
147
- var resetMap = function(){
148
-
149
- watchTime = new Date();
150
-
151
- Locator.getCurrentPosition(function(p){
152
-
153
- var pos = { lat: p.coords.latitude, lng: p.coords.longitude };
154
-
155
- map.setCenter(pos);
156
-
157
- Markers.current.setPosition(pos);
158
-
159
- Markers.start.setPosition(pos);
160
-
161
- PolyLine.setPath([new google.maps.LatLng(pos)]);
162
-
163
- });
164
-
165
- }
166
-
167
-
168
-
169
- // watchPositionイベント処理
170
-
171
- var watchHandler = function(p){
172
-
173
- if((new Date()) - watchTime < minInterval) return;
174
-
175
- watchTime = new Date();
176
-
177
- var pos = { lat: p.coords.latitude, lng: p.coords.longitude };
178
-
179
- map.setCenter(pos);
180
-
181
- Markers.current.setPosition(pos);
182
-
183
- PolyLine.getPath().push(new google.maps.LatLng(pos));
184
-
185
- PositionDisp.innerHTML = "緯度 " + pos.lat + " / 経度 " + pos.lng;
186
-
187
- }
188
-
189
-
190
-
191
-
192
-
193
- // *** 追跡用オブジェクト ***
194
-
195
- var tracker = {
196
-
197
- start: function(){
198
-
199
- if(watchID) return;
200
-
201
- resetMap();
202
-
203
- PositionDisp.innerHTML = "*** 受信中 ***";
204
-
205
- watchID = Locator.watchPosition(watchHandler);
206
-
207
- },
208
-
209
- stop: function(){
210
-
211
- Locator.clearWatch(watchID);
212
-
213
- PositionDisp.innerHTML = "*** 停止中 ***";
214
-
215
- watchID = null;
11
+ getcorrentbiid?
216
-
217
- }
218
-
219
- };
220
-
221
-
222
-
223
- resetMap();
224
-
225
- return tracker;
226
-
227
-
228
-
229
- })();
230
-
231
-
232
-
233
- // ボタンへのイベント設定
234
-
235
- var buttons = document.querySelectorAll("#contorol button");
236
-
237
- google.maps.event.addDomListener(buttons[0], "click", Tracker.start);
238
-
239
- google.maps.event.addDomListener(buttons[1], "click", Tracker.stop);
240
-
241
-
242
-
243
- </script>
244
-
245
- </body>
246
-
247
- </html>
248
-
249
- ```

2

実現したいこと変更

2017/01/11 07:17

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -1,8 +1,8 @@
1
1
  ###実現したいこと
2
2
 
3
- 下のgooglemap表示PC上では表示されが、iPhone表示することができません。googlechromeで表示する際には、「安全でないクリプトを込む」とをクリクしないと表示されません。位置情報を扱うプログラムなのでスマホで表示されなければ動作確認もできず困っています。
3
+ プログラムをデバックしたらgooglemap表示されるのは、PC上で確認できしたが、デスクトップPCのため位置の移動がきないので、位置情報および移動した場所の線の書き出しの動作の確認ができません。最終的には、スマーフォンおよびiphoneでのいのですが、スマートフォンおよびiphoneで起動した場合、マプが表示されません。お力添えよろしくお願いたします。
4
-
5
- お力添えよろしくお願いいたします。
4
+
5
+
6
6
 
7
7
 
8
8
 

1

タグの追加

2016/12/12 07:32

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
File without changes