【发布时间】:2014-09-24 09:36:45
【问题描述】:
我在 php 中使用 google geocoder API 来获取一个地方的 lat 和 lang。
<?php
$url = 'http://maps.googleapis.com/maps/api/geocode/json?address=Hollywood,+Newyork,+CA&sensor=true';
$response = file_get_contents($url);
$response = json_decode($response, true);
$lat = $response['results'][0]['geometry']['location']['lat'];
$long = $response['results'][0]['geometry']['location']['lng'];
echo "latitude: " . $lat . " longitude: " . $long;exit;
?>
它返回的纬度和经度值为 34.1408919,-118.350441。但是好莱坞在美国佛罗里达州。所以它不应该为我返回任何结果。我将如何实现这一目标
【问题讨论】:
标签: php google-maps google-geocoder google-geocoding-api