leaflet地图坐标点会随着地图的缩放发生变化,如有解决方法,请详细一点

0 投票
let lineUrl = require("images/index/map/line_map.png");

          let pointUrl = require("images/index/map/" + it.tc_pic + ".png");

          let pointIcon = L.divIcon({

            html:

              "<div class='indicator-box'><div style='display:flex'><img style='width:50px' src='" +

              pointUrl +

              "' /></div><div class='my-div-" +

              it.tc_leftRight +

              "'><img class='Img" +

              it.tc_leftRight +

              "' src='" +

              lineUrl +

              "'/><span class='my-div-names'>" +

              it.name +

              "</span ></div></div>",

            className: "my-div-icon",

            iconAnchor: [-10, 50]

          });

          let pointLayer = L.marker([it.lat, it.lng], {

            icon: pointIcon,

            attributes: it

          }).addTo(this.map);
3月 26 分类:  148次浏览 | 用户: 695816957 (3 分)

1个回答

1 投票
 
已采纳

你好,按理说marker不会有偏移的,你的是图片和描述偏移了?可以看一下leafletAPI中iCon中的参数设置一下偏移

3月 29 用户: johnJJ 学富五车 (622 分)
采纳于 3月 29 用户:695816957
...