質問編集履歴
2
書式の改善
title
CHANGED
File without changes
|
body
CHANGED
@@ -3,13 +3,15 @@
|
|
3
3
|
[リンク内容](https://developers.google.com/maps/documentation/javascript/examples/places-searchbox?hl=ja)
|
4
4
|
###発生している問題・エラーメッセージ
|
5
5
|
公式で使われている以下のコードを使ってみたのですが、うまくいきません。挿入する場所が悪いのかも分かっていません。初心者で申し訳ないのですが、よろしくお願い致します。
|
6
|
+
(追記)施設検索の部分は動くのですが、検索結果がクラスタ化されません。
|
6
7
|
```ここに言語を入力
|
7
8
|
var markerCluster = new MarkerClusterer(map, markers,
|
8
9
|
{imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'});
|
9
10
|
```
|
10
11
|
###該当のソースコード
|
11
12
|
```ここに言語を入力
|
13
|
+
```ここに言語を入力
|
12
|
-
|
14
|
+
<script>
|
13
15
|
function initAutocomplete() {
|
14
16
|
var map = new google.maps.Map(document.getElementById('map'), {
|
15
17
|
center: {lat: 35.0035315, lng: 135.7320783},
|
@@ -19,7 +21,9 @@
|
|
19
21
|
// Create the search box and link it to the UI element.
|
20
22
|
var input = document.getElementById('pac-input');
|
21
23
|
var searchBox = new google.maps.places.SearchBox(input);
|
22
|
-
|
24
|
+
//マーカークラスタの文を挿入しています。
|
25
|
+
var markerCluster = new MarkerClusterer(map, markers,
|
26
|
+
{imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'});
|
23
27
|
map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
|
24
28
|
|
25
29
|
// Bias the SearchBox results towards current map's viewport.
|
@@ -32,6 +36,7 @@
|
|
32
36
|
// more details for that place.
|
33
37
|
searchBox.addListener('places_changed', function() {
|
34
38
|
var places = searchBox.getPlaces();
|
39
|
+
|
35
40
|
if (places.length == 0) {
|
36
41
|
return;
|
37
42
|
}
|
1
書式の改善、リンク先の改善
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
###前提・実現したいこと
|
2
|
-
google maps apiを用いて施設検索できるコードを用いています。その検索結果をmarkerclustererでクラスタ化したいです。
|
2
|
+
google maps apiを用いて施設検索できるコードを用いています。その検索結果をmarkerclustererでクラスタ化したいです。以下のリンク先のコードを使用しています。
|
3
|
+
[リンク内容](https://developers.google.com/maps/documentation/javascript/examples/places-searchbox?hl=ja)
|
3
4
|
###発生している問題・エラーメッセージ
|
4
5
|
公式で使われている以下のコードを使ってみたのですが、うまくいきません。挿入する場所が悪いのかも分かっていません。初心者で申し訳ないのですが、よろしくお願い致します。
|
6
|
+
```ここに言語を入力
|
5
7
|
var markerCluster = new MarkerClusterer(map, markers,
|
6
8
|
{imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'});
|
9
|
+
```
|
7
10
|
###該当のソースコード
|
11
|
+
```ここに言語を入力
|
8
|
-
|
12
|
+
<script>
|
9
13
|
function initAutocomplete() {
|
10
14
|
var map = new google.maps.Map(document.getElementById('map'), {
|
11
15
|
center: {lat: 35.0035315, lng: 135.7320783},
|
@@ -72,9 +76,8 @@
|
|
72
76
|
}
|
73
77
|
|
74
78
|
</script>
|
79
|
+
```
|
75
80
|
|
76
81
|
###試したこと
|
77
82
|
課題に対してアプローチしたことを記載してください
|
78
|
-
var markerClusterを使ってみたのですが、クラスタ化されません。
|
83
|
+
var markerClusterを使ってみたのですが、クラスタ化されません。
|
79
|
-
###補足情報(言語/FW/ツール等のバージョンなど)
|
80
|
-
https://developers.google.com/maps/documentation/javascript/examples/places-searchbox?hl=ja
|