提交 | 用户 | 时间
|
58d006
|
1 |
<!DOCTYPE html> |
A |
2 |
<html> |
|
3 |
<head> |
|
4 |
<meta charset="utf-8"> |
|
5 |
<title>GMaps.js — Polylines</title> |
|
6 |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> |
|
7 |
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script> |
|
8 |
<script type="text/javascript" src="../gmaps.js"></script> |
|
9 |
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.3.0/bootstrap.min.css" /> |
|
10 |
<link rel="stylesheet" type="text/css" href="examples.css" /> |
|
11 |
<script type="text/javascript"> |
|
12 |
var map; |
|
13 |
$(document).ready(function(){ |
|
14 |
map = new GMaps({ |
|
15 |
el: '#map', |
|
16 |
lat: -12.043333, |
|
17 |
lng: -77.028333, |
|
18 |
click: function(e){ |
|
19 |
console.log(e); |
|
20 |
} |
|
21 |
}); |
|
22 |
|
|
23 |
path = [[-12.044012922866312, -77.02470665341184], [-12.05449279282314, -77.03024273281858], [-12.055122327623378, -77.03039293652341], [-12.075917129727586, -77.02764635449216], [-12.07635776902266, -77.02792530422971], [-12.076819390363665, -77.02893381481931], [-12.088527520066453, -77.0241058385925], [-12.090814532191756, -77.02271108990476]]; |
|
24 |
|
|
25 |
map.drawPolyline({ |
|
26 |
path: path, |
|
27 |
strokeColor: '#131540', |
|
28 |
strokeOpacity: 0.6, |
|
29 |
strokeWeight: 6 |
|
30 |
}); |
|
31 |
}); |
|
32 |
</script> |
|
33 |
</head> |
|
34 |
<body> |
|
35 |
<h1>GMaps.js — Polylines</h1> |
|
36 |
<div class="row"> |
|
37 |
<div class="span11"> |
|
38 |
<div id="map"></div> |
|
39 |
</div> |
|
40 |
<div class="span6"> |
|
41 |
<p>You can add polylines in GMaps.js this way:</p> |
|
42 |
<pre>path = [[-12.044012922866312, -77.02470665341184], [-12.05449279282314, -77.03024273281858], [-12.055122327623378, -77.03039293652341], [-12.075917129727586, -77.02764635449216], [-12.07635776902266, -77.02792530422971], [-12.076819390363665, -77.02893381481931], [-12.088527520066453, -77.0241058385925], [-12.090814532191756, -77.02271108990476]]; |
|
43 |
|
|
44 |
map.drawPolyline({ |
|
45 |
path: path, |
|
46 |
strokeColor: '#131540', |
|
47 |
strokeOpacity: 0.6, |
|
48 |
strokeWeight: 6 |
|
49 |
});</pre> |
|
50 |
<p>The path of the polyline is defined by an array of array of two (latitude and longitude).</p> |
|
51 |
</div> |
|
52 |
</div> |
|
53 |
</body> |
|
54 |
</html> |