我只需要知道如何从经度和纬度获取邮政编码。从经度和纬度获取邮编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");
}
});
}