forked from vicchi/maps-api-demos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmxn-home-and-work.js
39 lines (33 loc) · 961 Bytes
/
mxn-home-and-work.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
var mapstraction;
function initialize() {
var home = new mxn.LatLonPoint(51.4323, -0.3478);
var work = new mxn.LatLonPoint(52.5307, 13.4110);
var somewhere = new mxn.LatLonPoint(51.516, 7.46);
var connector = new mxn.Polyline([home, work]);
var homeMarker = new mxn.Marker(home);
var workMarker = new mxn.Marker(work);
connector.setWidth(3);
mapstraction = new mxn.Mapstraction('map', 'ovi');
mapstraction.addControls ({
pan: true,
zoom: 'large',
map_type: true
});
mapstraction.addMarkerWithData (homeMarker, {
infoBubble : "Where I Live",
draggable : false,
hover : true
});
var bubbleText = "Where I Work (" +
(work.distance(home).toFixed(1) * 0.6) +
" miles away)";
mapstraction.addMarkerWithData (workMarker, {
infoBubble : bubbleText,
draggable : false,
hover : true
});
homeMarker.openBubble();
workMarker.openBubble();
mapstraction.addPolyline(connector);
mapstraction.setCenterAndZoom(somewhere, 5);
}