将Google Geolocation API转换为Mapquest - County

时间:2013-12-23 10:21:44

标签: json google-maps geocoding

我有一个网站使用mapquest来获取基于用户邮政编码的信息,但我无法获得县记录。这是我的代码:

$mapping = file_get_contents("http://www.mapquestapi.com/geocoding/v1/address?key=****&postalCode=" . urlencode($postcode) . "&country=GB");
$geocodes = json_decode($mapping);

if($geocodes->info->statuscode === 0){
$lat = $geocodes->results[0]->locations[0]->latLng->lat;
$lon = $geocodes->results[0]->locations[0]->latLng->lng;
$city = $geocodes->results[0]->locations[0]->adminArea5;
$county = $geocodes->results[0]->locations[0]->adminArea4;

有谁知道如何让adminArea4工作?

0 个答案:

没有答案
相关问题