首页 / 浏览问题 / WebGIS / 问题详情
leaflet地图坐标点会随着地图的缩放发生变化,如有解决方法,请详细一点
3月26日, 2021
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);

1个回答

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

johnJJ  (845EXP)  才高八斗
3月29日, 2021
1
...