【发布时间】:2019-02-17 15:25:59
【问题描述】:
google 为reverse geocoding coordinates into full address 提供的示例代码很好,使用this stack question 上的回复时结果相同
问题是我不希望根据示例将它们放在信息框中,但我想更新我的输入字段,这是我现在使用的代码,删除了反向地理编码,因为我无法转换它变成一个输入值:
<p id="addressHelper" ></p>
<div id="map"></div>
var myMarker = new google.maps.Marker({
position: new google.maps.LatLng(47.651968, 9.478485),
draggable: true
});
google.maps.event.addListener(myMarker, 'dragend', function (evt) {
document.getElementById('addressHelper').innerHTML = '<p>Marker dropped: Current Lat: ' + evt.latLng.lat().toFixed(3) + ' Current Lng: ' + evt.latLng.lng().toFixed(3) + '</p>';
});
google.maps.event.addListener(myMarker, 'dragstart', function (evt) {
document.getElementById('addressHelper').innerHTML = '<p>Currently dragging marker...</p>';
});
map.setCenter(myMarker.position);
myMarker.setMap(map);
【问题讨论】:
-
没有解释,只是一个简单的、干巴巴的、不赞成的投票。甜的。谢谢
标签: javascript jquery google-maps