• 国内使用Google Maps JavaScript API


    <!DOCTYPE html>
    <html>
      <head>
        <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
        <meta charset="utf-8">
        <title>Simple markers</title>
        <style>
          html, body {
            height: 100%;
            margin: 0;
            padding: 0;
          }
          #map {
            height: 100%;
          }
        </style>
      </head>
      <body>
        <div id="map"></div>
        <script>
    
        function initMap() {
           var myLatLng = {lat: -25.363, lng: 131.044};
    
            var map = new google.maps.Map(document.getElementById('map'), {
              zoom: 4,
              center: myLatLng
           });
    
           var marker = new google.maps.Marker({
              position: myLatLng,
              map: map,
              title: 'Hello World!'
          });
        }
    
        </script>
        <script async defer
            src="https://maps.googleapis.com/maps/api/js?key=API_KEY&signed_in=true&callback=initMap"></script>
      </body>
    </html>

    <script src="http://maps.google.cn/maps/api/js?v=3.20&region=cn&language=zh-CN&key=your_key&callback=initMap"></script>

    上面两部分红色字比较重要,一个是在域名,一个是访问google地图的key,这个需要翻墙到google官网进行注册,然后复制过来就ok

    Get Key Link:

    https://developers.google.com/maps/documentation/javascript/?hl=zh-cn

  • 相关阅读:
    hashlib模块
    configparser模块
    xml模块和shelve模块
    json与pickle模块
    3/30
    os模块
    sys模块
    shutil模块
    random模块
    2月书单《编码隐匿在计算机软硬件背后的语言》 13-16章
  • 原文地址:https://www.cnblogs.com/henuyuxiang/p/9036345.html
Copyright © 2020-2023  润新知