The use of Gaode map in vue
Continuing from the use of el-amap in the high-definition map in vue written in the previous article
The previous article has already written how to use AutoNavi
下面说的是高德使用的一些注意点
高德的各种api可以找官方文档:
https://lbs.amap.com/api/jsapi-v2/documentation#map
el-amap version
<el-amap :events="events" ref="elMapRefs"></el-amap>
events:{
zoomchange:(e,i)=>{
console.log(e.zoomstart,i,"地图缩放")
console.log(this.$refs.GdMap.$$getInstance().getZoom())
// 级别
lebel=this.$refs.GdMap.$$getInstance().getZoom()
},
},
this.$refs.elMapRefs.$$getInstance
- You can find the corresponding api
可参考:https://blog.csdn.net/weixin_42241439/article/details/111319932
- Own overlays drawn on the map
var addMarker = new AMap.Marker({
map: map,
//icon: imgUrl,
position: [Lng, Lat],
offset: new AMap.Pixel(top, left),
content: '<div class="' + imgbgMap + '" id="'+ marker_nid +'" data-clickstatu="false"><img src="' + imgUrl + '"></div>'
});
remove the specified overlayremove
addMarker是我后面画的覆盖物,而用"var map = new AMap.Map('map', {})"画的标注中心点两者是分开的。
map.remove(addMarker);这种可以传参的方法,在清除覆盖物的时候则不会把中心标注点也清掉了
map.remove(addMarker);
Clear the last overlay clearMap
,setMap
这个跟上面的方法不同在于是把地图上所有的覆盖物都删除,其中当然包括了中心标注点
map.clearMap();
addMarker.setMap(null);
js version
- Add a satellite layer
TileLayer.Satellite
effect
js版本图片参考:https://blog.csdn.net/weixin_60131763/article/details/122894174?ops_request_misc=&request_id=&biz_id=102&utm_term=amap/amap-jsapi-loader%20%E8%AE%BE%E7%BD%AE%E5%8D%AB%E6%98%9F%E5%9C%B0%E5%9B%BE&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-0-122894174.142^v66^control,201^v3^control_1,213^v2^t3_control2&spm=1018.2226.3001.4187