我有一个问题,设置标记并获得该标记的经度和纬度。我怎样才能做到谷歌地图v3 API谷歌地图API v3集标记和获取点
var myLatlng = new google.maps.LatLng(-34.397, 150.644);
var myOptions = {
zoom: 8,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("divGoogleMaps"), myOptions);
google.maps.event.addListener(map, 'click', function() {
});
这是我的开始代码。
最后这段代码帮我做了这件事。我可以在地图上只能有一个标记,这个标记,当用户cliks在地图上的“代码” google.maps.event.addListener(地图“点击”设置功能(事件){ \t \t \t如果(self.marker! = NULL) \t \t \t \t self.marker.setMap(空); \t \t \t self.value =新google.maps.LatLng(event.latLng.lat(),event.latLng.lng()); \t \t \t \t self.marker =新google.maps.Marker({ \t \t \t \t位置:0 self.value\t \t \t}); \t \t \t self.zoom = map.getZoom(); \t \t \t self.marker.setMap(map); \t}); – user821738