main.py
CHANGED
@@ -61,15 +61,26 @@ var rec_list = res['recommendations']
|
|
61 |
console.log(rec_list);
|
62 |
|
63 |
rec_list.forEach((elem) => addElem(elem));
|
|
|
|
|
|
|
|
|
64 |
|
65 |
}
|
66 |
|
|
|
|
|
|
|
|
|
67 |
function addElem(elem)
|
68 |
{
|
69 |
//var marker = L.marker([elem['latitude'], elem['longitude']]).addTo(map);
|
70 |
var marker = L.marker([elem['latitude'], elem['longitude']]).addTo(map);
|
71 |
marker.bindPopup(elem['name'])
|
72 |
|
|
|
|
|
|
|
73 |
}
|
74 |
|
75 |
|
|
|
61 |
console.log(rec_list);
|
62 |
|
63 |
rec_list.forEach((elem) => addElem(elem));
|
64 |
+
avg_lat = lat_sum / marker_count;
|
65 |
+
avg_lng = lng_sum / marker_count;
|
66 |
+
|
67 |
+
map.setView([avg_lat, avg_lng], 10);
|
68 |
|
69 |
}
|
70 |
|
71 |
+
let marker_count = 0;
|
72 |
+
let lat_sum = 0;
|
73 |
+
let lng_sum = 0;
|
74 |
+
|
75 |
function addElem(elem)
|
76 |
{
|
77 |
//var marker = L.marker([elem['latitude'], elem['longitude']]).addTo(map);
|
78 |
var marker = L.marker([elem['latitude'], elem['longitude']]).addTo(map);
|
79 |
marker.bindPopup(elem['name'])
|
80 |
|
81 |
+
marker_count++;
|
82 |
+
lat_sum += [elem['latitude'];
|
83 |
+
lng_sum += [elem['longitude'];
|
84 |
}
|
85 |
|
86 |
|