提交 | 用户 | 时间
|
58d006
|
1 |
<!DOCTYPE html> |
A |
2 |
<html> |
|
3 |
<head> |
|
4 |
<meta charset="utf-8"> |
|
5 |
<title>GMaps.js — Elevation locations</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 |
}); |
|
19 |
//locations request |
|
20 |
map.getElevations({ |
|
21 |
locations : [[-12.040397656836609,-77.03373871559225], [-12.050047116528843,-77.02448169303511], [-12.044804866577001,-77.02154422636042]], |
|
22 |
callback : function (result, status){ |
|
23 |
if (status == google.maps.ElevationStatus.OK) { |
|
24 |
for (var i in result){ |
|
25 |
map.addMarker({ |
|
26 |
lat: result[i].location.lat(), |
|
27 |
lng: result[i].location.lng(), |
|
28 |
title: 'Marker with InfoWindow', |
|
29 |
infoWindow: { |
|
30 |
content: '<p>The elevation is '+result[i].elevation+' in meters</p>' |
|
31 |
} |
|
32 |
}); |
|
33 |
} |
|
34 |
} |
|
35 |
} |
|
36 |
}); |
|
37 |
}); |
|
38 |
</script> |
|
39 |
</head> |
|
40 |
<body> |
|
41 |
<h1>GMaps.js — Elevation locations</h1> |
|
42 |
<div class="row"> |
|
43 |
<div class="span11"> |
|
44 |
<div id="map"></div> |
|
45 |
</div> |
|
46 |
<div class="span6"> |
|
47 |
<p>With GMaps.js you can add elevation this way:</p> |
|
48 |
<pre>map.getElevations({ |
|
49 |
locations : [[-12.040397656836609,-77.03373871559225], [-12.050047116528843,-77.02448169303511], [-12.044804866577001,-77.02154422636042]], |
|
50 |
callback : function (result, status){ |
|
51 |
if (status == google.maps.ElevationStatus.OK) { |
|
52 |
console.log(result, status); |
|
53 |
} |
|
54 |
} |
|
55 |
});</pre> |
|
56 |
|
|
57 |
</div> |
|
58 |
</div> |
|
59 |
</body> |
|
60 |
</html> |