googlemaps.html 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>wuyineibor</title>
  5. <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
  6. <style type="text/css">
  7. html { overflow: hidden; }
  8. body { overflow: hidden; padding: 0; margin: 0;
  9. width: 100%; height: 100%; font-family: Trebuchet MS, Trebuchet, Arial, sans-serif; }
  10. #map { position: absolute; top: 10px; left: 10px; right: 10px; bottom: 15px; overflow: auto; }
  11. #footer { position: absolute; bottom: 0px; left: 0px; width:100%; height: 12px; overflow: hidden; }
  12. @media screen and (max-width: 600px) {
  13. #map { top:0px; left:0px; width:100%; height:100%;}
  14. }
  15. body { background: #f4f4f4;}
  16. #header { background: #fff; box-shadow: 0 1px 3px #CCC; border: 1px solid #ccc; }
  17. #header h1 { padding:7px 10px; margin:0; font-size: 28px; }
  18. #map { border: 1px solid #ccc; box-shadow: 0 1px 3px #CCC; background-color: #DEDCD7;}
  19. #footer { text-align:center; font-size:9px; color:#606060; }
  20. </style>
  21. <!--[if lte IE 6]>
  22. <style type="text/css">
  23. #map {
  24. height:expression(document.body.clientHeight-35); /* 10+10+15=35 */
  25. width:expression(document.body.clientWidth-20); /* 10+10=20 */
  26. }
  27. </style>
  28. <![endif]-->
  29. <script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
  30. <!-- Get your Google Maps API Key: https://developers.google.com/maps/documentation/javascript/tutorials/adding-a-google-map#introduction-->
  31. <!-- <script type="text/javascript" src="https://maps.google.com/maps/api/js?key=YOUR_API_KEY&sensor=false"></script> -->
  32. <script type="text/javascript">
  33. var map;
  34. var mapBounds = new google.maps.LatLngBounds(
  35. new google.maps.LatLng(22.483461, 112.916977),
  36. new google.maps.LatLng(22.809082, 113.179119));
  37. var mapMinZoom = 9;
  38. var mapMaxZoom = 18;
  39. var maptiler = new google.maps.ImageMapType({
  40. getTileUrl: function(coord, zoom) {
  41. var proj = map.getProjection();
  42. var z2 = Math.pow(2, zoom);
  43. var tileXSize = 256 / z2;
  44. var tileYSize = 256 / z2;
  45. var tileBounds = new google.maps.LatLngBounds(
  46. proj.fromPointToLatLng(new google.maps.Point(coord.x * tileXSize, (coord.y + 1) * tileYSize)),
  47. proj.fromPointToLatLng(new google.maps.Point((coord.x + 1) * tileXSize, coord.y * tileYSize))
  48. );
  49. var x = coord.x >= 0 ? coord.x : z2 + coord.x
  50. var y = coord.y;
  51. if (mapBounds.intersects(tileBounds) && (mapMinZoom <= zoom) && (zoom <= mapMaxZoom))
  52. return zoom + "/" + x + "/" + y + ".png";
  53. else
  54. return "https://www.maptiler.com/img/none.png";
  55. },
  56. tileSize: new google.maps.Size(256, 256),
  57. isPng: true,
  58. name: "Rendered with MapTiler Desktop",
  59. alt: "Rendered with MapTiler Desktop",
  60. opacity: 1.0
  61. });
  62. function init() {
  63. var opts = {
  64. tilt:0,
  65. streetViewControl: false,
  66. center: new google.maps.LatLng(22.646271, 113.048048),
  67. zoom: 9
  68. };
  69. map = new google.maps.Map(document.getElementById("map"), opts);
  70. map.setMapTypeId('satellite');
  71. map.overlayMapTypes.insertAt(0, maptiler);
  72. }
  73. </script>
  74. </head>
  75. <body onload="init()">
  76. <div id="footer">Rendered with <a href="https://www.maptiler.com/">MapTiler Desktop</a></div>
  77. <div id="map"></div>
  78. </body>
  79. </html>