当前位置:网站首页>Baidu Map Case - modify map style

Baidu Map Case - modify map style

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

https://lbsyun.baidu.com/apiconsole/custommap
Click... On this website Featured service platform - Personalized maps - Map template - Select a map style - Click publish style - Copy id Into the code

<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 
  //  Custom map style 
  //  You can also use styleJsion The way to change the style 
  map.setMapStyleV2({
    styleId:'06649c73ab8ae3adffe6ea88ed400b23'
  })
</script>
</body>
</html>

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