zoukankan      html  css  js  c++  java
  • 简易google地图api调用

    代码如下:

    <!DOCTYPE html>
    <html>
      <head>
        <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
        <style type="text/css">
          html { height: 100% }
          body { height: 100%; margin: 0; padding: 0 }
          #map_canvas { height: 100% }
        </style>
        <script type="text/javascript"
          src="http://maps.googleapis.com/maps/api/js?key=your-api-key&sensor=true">
        </script>
        <script type="text/javascript">
          function initialize() {
            var mapOptions = {
              center: new google.maps.LatLng(-34.397, 150.644),
              zoom: 8,
              mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            var map = new google.maps.Map(document.getElementById("map_canvas"),
                mapOptions);
          }
        </script>
      </head>
      <body onload="initialize()">
        <div id="map_canvas" style="100%; height:100%">    </div>
      </body>
    </html>
    View Code

    zoom设置得越小~则地图显示范围越大~

    new google.maps.LatLng(X,Y)输入经纬度。

    获取api-key:
    https://developers.google.com/maps/documentation/javascript/tutorial?hl=zh-cn#api_key 

    https://code.google.com/apis/console/b/0/?noredirect#project:547251066599:access

  • 相关阅读:
    Quick Find
    并查集
    树形问题和更多树
    二叉搜索树的局限性
    Oracle Auto Increment Column
    测试机器性能
    EXP/IMP version
    python getaddrinfo 函数
    open cursor too much error
    要看的一些链接
  • 原文地址:https://www.cnblogs.com/Jokers/p/3611284.html
Copyright © 2011-2022 走看看