[英]Google map api v3 Show coordinates while draw polyline
我注意到,只有在折線完成后才能獲取折線的坐標:
google.maps.event.addListener(drawingManager, 'polylinecomplete', function (...)
在繪制折線時,有沒有辦法獲取折線的坐標?
如果要手動繪制折線(使用鼠標),則可以在將光標移到地圖上時獲取光標的坐標:
鼠標移動:
google.maps.event.addListener(map, 'mousemove', function(event) {
document.getElementById('latitude').value = event.latLng.lat();
document.getElementById('longitude').value = event.latLng.lng();
});
HTML: <input type="text" id="longitude"><input type="text" id="longitude">
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.