hjg
2024-10-30 8cf23534166c07e711aac2a25911ada317ba01f0
提交 | 用户 | 时间
58d006 1 <!DOCTYPE html>
A 2 <html>
3 <head>
4   <meta charset="utf-8">
5   <title>GMaps.js &mdash; Routes</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       map.drawRoute({
20         origin: [-12.044012922866312, -77.02470665341184],
21         destination: [-12.090814532191756, -77.02271108990476],
22         travelMode: 'driving',
23         strokeColor: '#131540',
24         strokeOpacity: 0.6,
25         strokeWeight: 6
26       });
27     });
28   </script>
29 </head>
30 <body>
31   <h1>GMaps.js &mdash; Routes</h1>
32   <div class="row">
33     <div class="span11">
34       <div id="map"></div>
35     </div>
36     <div class="span6">
37       <p>With GMaps.js you can draw a route between two points this way:</p>
38       <pre>map.drawRoute({
39   origin: [-12.044012922866312, -77.02470665341184],
40   destination: [-12.090814532191756, -77.02271108990476],
41   travelMode: 'driving',
42   strokeColor: '#131540',
43   strokeOpacity: 0.6,
44   strokeWeight: 6
45 });</pre>
46       <p>You must define two points (<strong>origin</strong> and <strong>destination</strong>) and color, opacity and weight of the route in the map.</p>
47       <p>Also, you can define a <code>travelMode</code>: <code>driving</code>, <code>bicycling</code> or <code>walking</code>. Default is <code>walking</code></p>
48     </div>
49   </div>
50 </body>
51 </html>