hjg
2024-07-09 30304784e82d4bba24121328da8eb8490aec4f4f
提交 | 用户 | 时间
58d006 1 <!DOCTYPE html>
A 2 <html>
3 <head>
4   <meta charset="utf-8">
5   <title>GMaps.js &mdash; Static map</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 url = GMaps.staticMapURL({
14         size: [610, 350],
15         lat: -12.043333,
16         lng: -77.028333,
17         styles: [{
18           featureType: "all",
19           elementType: "all",
20           stylers: [
21             { hue: '#FF0000' }
22           ]
23         },
24         {
25           featureType: "landscape",
26           elementType: "all",
27           stylers: [
28             { hue: '#0A2D3F'},
29             { saturation: 50 },
30             { lightness: -10 }
31           ]
32         }]
33       });
34       $('<img/>').attr('src', url).appendTo('#map');
35     });
36   </script>
37 </head>
38 <body>
39   <h1>GMaps.js &mdash; Static map</h1>
40   <div class="row">
41     <div class="span11">
42       <div id="map"></div>
43     </div>
44     <div class="span6">
45       <p>You can use the same styles as for a normal styled map to make a static map using GMaps.js:</p>
46       <pre>url = GMaps.staticMapURL({
47   size: [610, 350],
48   lat: -12.043333,
49   lng: -77.028333
50   styles: [{
51     featureType: "all",
52     elementType: "all",
53     stylers: [
54       { hue: '#FF0000' }
55     ]
56   },
57   {
58     featureType: "landscape",
59     elementType: "all",
60     stylers: [
61       { hue: '#0A2D3F'},
62       { saturation: 50 },
63       { lightness: -10 }
64     ]
65   }]
66 });
67
68 $('&lt;img/&gt;').attr('src', url)
69   .appendTo('#map');</pre>
70     </div>
71   </div>
72 </body>
73 </html>