【Leaflet】鼠标提取坐标

    map.on('mousemove', function (e) {
        document.getElementById('info').innerHTML = /* innerHTML 属性设置或返回表格行的开始和结束标签之间的 HTML  */
            // e.point is the x, y coordinates of the mousemove event relative
            // to the top-left corner of the map
            JSON.stringify(e.containerPoint) + '<br />' +
            // e.lngLat is the longitude, latitude geographical position of the event
            JSON.stringify(e.latlng); /* JSON.stringify() 方法可以将任意的 JavaScript 值序列化成 JSON 字符串 */
    });

 

转载自:https://blog.csdn.net/weixin_34050005/article/details/86364298

You may also like...

退出移动版