質問編集履歴

1

タイトルを変えました

2016/11/11 12:44

投稿

oyatsu8
oyatsu8

スコア97

test CHANGED
@@ -1 +1 @@
1
- LeafletにGeojsonを読み込んだときポップアップのsytleやpopupContentの挙動がわからない
1
+ LeafletのポップアップのsytleやpopupContentの挙動がわからない
test CHANGED
@@ -1,161 +1,3 @@
1
- leafletでgeojsonを読み込んでポップアップを表示させたいのですが、
2
-
3
- styleを設定すると、ポップアップが出てこなくなります。
4
-
5
- 下記のindex.htmlの下の方に、このようなコードがあるのですが、
6
-
7
- これを入れると指定したスタイルのポップアップは出るのですが、
8
-
9
- cat_geojson.jsで指定している、popupContentは反映されなくなってしまいます。
10
-
11
- styleをどう指定したらいいのでしょうか?
12
-
13
-
14
-
15
-
16
-
17
- //ここを入れるとスタイルは反映され、ポップアップが立たなくなる
18
-
19
- pointToLayer: function (feature, latlng) {
20
-
21
- return L.circleMarker(latlng, {
22
-
23
- radius: 8,
24
-
25
- fillColor: "#ff7800",
26
-
27
- color: "#000",
28
-
29
- weight: 1,
30
-
31
- opacity: 1,
32
-
33
- fillOpacity: 0.8
34
-
35
- });
36
-
37
- }
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
- ```javascript cat_geojson.js
46
-
47
- var cat = {
48
-
49
- "type": "FeatureCollection",
50
-
51
- "features": [
52
-
53
- {
54
-
55
- "type": "feature",
56
-
57
- "geometry":{
58
-
59
- "type":"Point",
60
-
61
- "coordinates":[
62
-
63
- 141.347899,
64
-
65
- 40.863968
66
-
67
- ]
68
-
69
- },
70
-
71
- "type": "Feature",
72
-
73
- "properties":{
74
-
75
- "popupContent":"三毛猫",
76
-
77
- "title":"三毛猫",
78
-
79
- "material":"ネコ",
80
-
81
- "style": {//変更してみた
82
-
83
- weight: 2,
84
-
85
- color: "#444",
86
-
87
- opacity: 1,
88
-
89
- fillColor: "#00f",
90
-
91
- fillOpacity: 0.8
92
-
93
- } ,
94
-
95
- "color":"#00F"
96
-
97
- },
98
-
99
- "id": 1
100
-
101
- },{
102
-
103
- "type": "feature",
104
-
105
- "geometry":{
106
-
107
- "type":"Point",
108
-
109
- "coordinates":[
110
-
111
- 141.347899,
112
-
113
- 41.863968
114
-
115
- ]
116
-
117
- },
118
-
119
- "type": "Feature",
120
-
121
- "properties":{
122
-
123
- "popupContent":"黒猫",
124
-
125
- "title":"黒猫",
126
-
127
- "material":"ネコ",
128
-
129
- "style": {//変更してみた
130
-
131
- weight: 2,
132
-
133
- color: "#444",
134
-
135
- opacity: 1,
136
-
137
- fillColor: "#f00",
138
-
139
- fillOpacity: 0.8
140
-
141
- } ,
142
-
143
- "color":"#00F"
144
-
145
- },
146
-
147
- "id": 1
148
-
149
- },
150
-
151
- ]};//JSONデータ おわり
152
-
153
-
154
-
155
- ```
156
-
157
-
158
-
159
1
  ```javascript index.html
160
2
 
161
3
  <!doctype html>