【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 字符串 */
    });

 

posted @ 2018-11-12 14:22  咸鱼翻身  阅读(3802)  评论(0编辑  收藏  举报