google map的简单应用-显示华南理工大学

写一个简单的Google Map 的应用程序,一个显示我们学校(South China University of Technology)地图的网页

通过Google搜索获取我们学校的经度纬度

使用Google Maps JavaScript API V3

按照以下教程的步骤: Google Map Javascript API V3 Tutorial

在google地图上点击某地方可显示经纬度

参考网址:https://developers.google.com/maps/documentation/javascript/tutorial?hl=zh-cn

<!DOCTYPE html>
<html>
  <head>
    <title>Simple Map</title>
    <meta name="viewport" content="initial-scale=1.0">
    <meta charset="utf-8">
    <style>
      html, body {
        height: 100%;
        margin: 0;
        padding: 0;
      }
      #map {
        height: 100%;
      }
    </style>
  </head>
  <body>
    <div id="map"></div>
    <script>

var map;
function initMap() {
  map = new google.maps.Map(document.getElementById('map'), {
    center: {lat: 23.048180, lng: 113.404039}, //经纬度
    zoom: 17
  });
}

    </script>
    <script src="https://maps.googleapis.com/maps/api/js?key=【你的api key,需登录谷歌账号获取】=initMap"
        async defer></script>
  </body>
</html>


显示效果:



  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值