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

  • 相关阅读:
    jar 包说明
    WebView 下载
    动画
    activity 做出 dialog 效果
    android 数据报表
    拖动 view
    开发收集
    tomcat 5 comcat 6 区别
    android 屏幕判断
    FPS游戏
  • 原文地址:https://www.cnblogs.com/Jokers/p/3611284.html
Copyright © 2011-2022 走看看