当前位置:网站首页>Basic case of Baidu map

Basic case of Baidu map

2022-04-23 17:03:00 Eli-sun

 <script type="text/javascript" 
  src="https://api.map.baidu.com/api?v=1.0&type=webgl&ak=cXG18I5SNt2EZNvG7CVyE4jjTr8swlo4"
  ></script>
  //  This was introduced ak To apply for a Baidu map developer account , You can click in through the following website 
  https://lbsyun.baidu.com/index.php?title=jspopularGL/guide/helloworld
  

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script type="text/javascript" 
  src="https://api.map.baidu.com/api?v=1.0&type=webgl&ak=cXG18I5SNt2EZNvG7CVyE4jjTr8swlo4"
  ></script>
  <style>
    html{
      height: 100%;
      height: 100%;
      margin: 0;
      padding: 0;
    }
    body{
      height: 100%;
      height: 100%;
      margin: 0;
      padding: 0;
    }
    #map{
      height: 100%;
      width: 100%;
      margin: 0;
      padding: 0;
    }
    .anchorBL, .BMap_cpyCtrl{
display: none;
    }
  </style>
</head>

<body>
  <div id="map"></div>
  <script>
    console.log(window.BMapGL);
    var map = new BMapGL.Map('map') //  Initialize map 
    var point = new BMapGL.Point(116.404,39.915) //  Set map coordinates 
    map.centerAndZoom(point, 10) //  Central   Map display level  
    map.enableScrollWheelZoom(true) //  Zoom in and out of the map through the scroll wheel 
  </script>
</body>
</html>

版权声明
本文为[Eli-sun]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230554289813.html