-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmapUtils.js
45 lines (38 loc) · 970 Bytes
/
mapUtils.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function codeAddress(address, callback) {
var geocoder = new google.maps.Geocoder();
geocoder.geocode({
'address' : address
}, handleAddressCoded);
}
function displayMap(div) {
var mapOptions = {
center : new google.maps.LatLng(40.76727216, -73.99392888),
zoom : 4,
mapTypeId : google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(div, mapOptions);
return map;
}
function addMarker(map, dp)
{
var marker = new google.maps.Marker({
map: map,
title: dp.stationName,
position: new google.maps.LatLng(dp.latitude, dp.longitude)
});
}
function centerMapOn(map, datum)
{
console.log("old center: " + map.getCenter());
map.setCenter(new google.maps.LatLng(40.76727216, -73.99392888));//datum.latitude, datum.longitude));
console.log("center: " + map.getCenter());
}
function addMarkersForDataDump(map, dump)
{
console.log(dump);
centerMapOn(map, dump[0]);
for (var i=0; i < dump.length; i++)
{
addMarker(map, dump[i]);
}
}