Google Map通過經緯度獲取詳細地址

    
myLatLng = new google.maps.LatLng(23.149, 113.349);
var beachMarker = new google.maps.Marker({
    position: myLatLng,
        map: map
});
var geocoder = new google.maps.Geocoder();

google.maps.event.addListener(beachMarker, 'click', function () { 
    geocoder.geocode( { 'location': myLatLng}, function(results, status) {
	if (status == google.maps.GeocoderStatus.OK) {
		console.log(results[0].formatted_address);
	} else {
		console.log('error');
	}
    });
});



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章