百度地图上marker点发生偏移

编程入门 行业动态 更新时间:2024-10-15 00:24:17

百度地<a href=https://www.elefans.com/category/jswz/34/1759226.html style=图上marker点发生偏移"/>

百度地图上marker点发生偏移

我们是后端返回的具体的位置信息,然后在百度地图上读取的时候不能把具体的坐标读取完全(返回130.2555555555)地图控件读取的时候是(120.2555),解决办法就是直接给marker点新增一个对象

// 向marker中存储数据
this.editMk.item = e

// marker标记点坐标
this.poleList.forEach(e => {
this.editPoint = new BMap.Point(e.lng, e.lat)

            // 添加marker图片 设置大小 标记点不能拖动 没有定义缩放地图时改变图片大小this.editMk = new BMap.Marker(this.editPoint, { icon: new BMap.Icon(require('@/assets/bigScreen/dian.png'), new BMap.Size(18, 18), { imageSize: new BMap.Size(18, 18) }), enableMassClear: false, enableDragging: false })// 向marker中存储数据this.editMk.item = ethis.map.addOverlay(this.editMk)this.editMk.addEventListener('click', (e) => {// that.showHidePole = trueconsole.log(e, 'woshi eeee')this.$refs.poles.style.display = 'block'const lng = e.target.item.lngconst lat = e.target.item.latconst projectId = window.localStorage.getItem('equipmentProject')const params = {lng: lng,lat: lat,projectId: projectId}queryPoleAndAttributeDeviceByLatAndLng(params).then(res => {console.log(res.data, '新增灯杆信息')this.deviceName = res.data[0].pole.deviceName// 灯杆名称this.deviceCode = res.data[0].pole.deviceCode// 灯杆编号})})})

更多推荐

百度地图上marker点发生偏移

本文发布于:2024-03-09 00:25:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1723015.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图上   发生   marker

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!