Administrator
2022-09-14 58d006e05dcf2a20d0ec5367dd03d66a61db6849
提交 | 用户 | 时间
58d006 1 <!DOCTYPE html>
A 2 <html>
3 <head>
4   <meta charset="utf-8">
5   <title>GMaps.js &mdash; Static map with polyline</title>
6   <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
7   <script src="http://maps.google.com/maps/api/js?sensor=true"></script>
8   <script 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>
12     $(document).ready(function(){
13       var path = [
14         [-12.040397656836609,-77.03373871559225],
15         [-12.040248585302038,-77.03993927003302],
16         [-12.050047116528843,-77.02448169303511],
17         [-12.044804866577001,-77.02154422636042],
18         [-12.040397656836609,-77.03373871559225]
19       ];
20
21       var url = GMaps.staticMapURL({
22         size: [610, 350],
23         lat: -12.043333,
24         lng: -77.028333,
25         polyline: {
26           path: path,
27           strokeColor: '#131540',
28           strokeOpacity: 0.6,
29           strokeWeight: 6
30         }
31       });
32       $('<img/>').attr('src', url).appendTo('#map');
33     });
34   </script>
35 </head>
36 <body>
37 <h1>GMaps.js &mdash; Static map with polyline</h1>
38   <div class="row">
39     <div class="span11">
40       <div id="map"></div>
41     </div>
42     <div class="span6">
43       <p>A single polyline can be also drawed in a static map:</p>
44       <pre>url = GMaps.staticMapURL({
45   size: [610, 350],
46   lat: -12.043333,
47   lng: -77.028333,
48
49   polyline: {
50     path: path,
51     strokeColor: '#131540',
52     strokeOpacity: 0.6,
53     strokeWeight: 6
54   }
55 });
56
57 $('&lt;img/&gt;').attr('src', url)
58   .appendTo('#map');</pre>
59     </div>
60   </div>
61 </body>
62 </html>