我只需要知道如何從經度和緯度獲取郵政編碼。從經度和緯度獲取郵編google api
我使用谷歌地圖API來獲取長和緯度基於搜索,如'曼徹斯特',然後我需要一個從這個郵政編碼查詢我的數據庫。
到目前爲止我的代碼是
function getLatLng()
{
var localSearch = new google.maps.Geocoder();
var postcode = $("#address").val();
localSearch.geocode({ 'address': postcode },
function(results, status) {
if (results.length == 1) {
var result = results[0];
var location = result.geometry.location;
}
else
{
$("#error").html("Address not found");
}
});
}