当前位置:网站首页>Baidu Map Case - Zoom component, map scale component
Baidu Map Case - Zoom component, map scale component
2022-04-23 17:03:00 【Eli-sun】
<!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, 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>
<!--
Can be in Baidu map - Developing documents - Coordinate picker Search the place you want and get the longitude and latitude of the place
-->
<div id="map"></div>
<script>
// console.log(window.BMapGL);
var map = new BMapGL.Map('map', {
minZoom: 8,
maxZoom:12,
mapType: BMAP_NORMAL_MAP
}) // Initialize map
var point = new BMapGL.Point(116.196608,40.253428) // Set map coordinates
map.centerAndZoom(point, 5) // Central Map display level
map.enableScrollWheelZoom(true) // Zoom in and out of the map through the scroll wheel
var heading = 0
map.setHeading(60) // Adjust the rotation angle
map.setTilt(70) // Adjust the tilt angle
// setInterval(()=>{
// heading++
// map.setHeading(heading)
// },500)
map.setMapType(BMAP_NORMAL_MAP)
// BMAP_EARTH_MAP The earth map
// map.setMinZoom(8) // The minimum scalable setting is 8
// map.setMaxZoom(12) // The maximum scalable is 12
var zoomCtrl = new BMapGL.ZoomControl({
anchor:BMAP_ANCHOR_BOTTOM_RIGHT, // Change the placement of icons There can be 4 The central method
offset: new BMapGL.Size(100, 10) // Adjust the position of the icon more accurately
})
map.addControl(zoomCtrl)
map.addEventListener('zoomstart', function() {
console.log('000',map.getZoom());
}) // The method of event binding
map.addEventListener('zoomend', function() {
console.log('111',map.getZoom());
})
var scaleCtrl = new BMapGL.ScaleControl({
anchor:BMAP_ANCHOR_TOP_LEFT,
offset:new BMapGL.Size(10,10)
}) // Set map scale icon
map.addControl(scaleCtrl)
</script>
</body>
</html>
版权声明
本文为[Eli-sun]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230554289680.html
边栏推荐
- SQL database
- feign报400处理
- 线性代数感悟之2
- Promise (II)
- Encapsulating the logging module
- Aiot industrial technology panoramic structure - Digital Architecture Design (8)
- Grpc gateway based on Ocelot
- 【WPF绑定3】 ListView基础绑定和数据模板绑定
- The new MySQL table has a self increasing ID of 20 bits. The reason is
- Calculation formula related to tolerance analysis
猜你喜欢

Node access to Alipay open platform sandbox to achieve payment function

Document operation II (5000 word summary)

STM32__ 03 - beginner timer
![[PROJECT] small hat takeout (8)](/img/54/0187eeb637f4dcd4ad3969b00e2b77.png)
[PROJECT] small hat takeout (8)

Grpc gateway based on Ocelot

Shell脚本——Shell编程规范及变量

Detailed explanation of information abstract, digital signature, digital certificate, symmetric encryption and asymmetric encryption

Mock test using postman

详解牛客----手套

Loggie source code analysis source file module backbone analysis
随机推荐
蓝桥杯省一之路06——第十二届省赛真题第二场
Solution architect's small bag - 5 types of architecture diagrams
ByteVCharts可视化图表库,你想要的我都有
Decimal format decimal / datetime conversion processing
PostgreSQL column storage and row storage
Sub database and sub table & shardingsphere
Talk about browser cache control
BUG_ me
Paging SQL
深入了解3D模型相关知识(建模、材质贴图、UV、法线),置换贴图、凹凸贴图与法线贴图的区别
How to implement distributed locks with redis?
ACL 2022 | dialogved: a pre trained implicit variable encoding decoding model for dialogue reply generation
Detailed explanation of Niuke - Gloves
Zhimeng dedecms security setup Guide
Rtklib 2.4.3 source code Notes
groutine
Aiot industrial technology panoramic structure - Digital Architecture Design (8)
Interface document yaml
Installing labellmg tutorial in Windows
Nodejs installation and environment configuration