Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何通过谷歌地图api获得正确的地址?_Javascript_Google Maps_Google Maps Api 3 - Fatal编程技术网

Javascript 如何通过谷歌地图api获得正确的地址?

Javascript 如何通过谷歌地图api获得正确的地址?,javascript,google-maps,google-maps-api-3,Javascript,Google Maps,Google Maps Api 3,所以在我正在建立的一个网站上,我需要显示一张地图,上面有两个标记,一个是某个画家出生的地方,另一个是同一个人死亡的地方 其中一个地方是澳大利亚的贝德福德唐斯车站。现在,当我在google中键入此内容时,我得到了正确的结果: ,即澳大利亚的一个地方 现在,当我尝试在我的网站上使用谷歌api做同样的事情时,我只得到美国的位置: 为什么?我使用谷歌API获取地址的纬度和逻辑度, ` 此功能一直运行良好,希望对您有所帮助 谷歌地图链接是一个“地点”条目。可能的重复可能的重复 public funct

所以在我正在建立的一个网站上,我需要显示一张地图,上面有两个标记,一个是某个画家出生的地方,另一个是同一个人死亡的地方

其中一个地方是澳大利亚的贝德福德唐斯车站。现在,当我在google中键入此内容时,我得到了正确的结果: ,即澳大利亚的一个地方

现在,当我尝试在我的网站上使用谷歌api做同样的事情时,我只得到美国的位置:


为什么?

我使用谷歌API获取地址的纬度和逻辑度, `

此功能一直运行良好,希望对您有所帮助

谷歌地图链接是一个“地点”条目。可能的重复可能的重复
  public function latitudeLongitudeFromAdresse($address) {

    $coordinates = file_get_contents('http://maps.googleapis.com/maps/api/geocode/json?address=' .urlencode($adresses).'&sensor=true');
    $coordinates = json_decode($coordinates);

    $latitude_longitude = array(
        "latitude" => $coordinates->results[0]->geometry->location->lat,
        'longitude' => $coordinates->results[0]->geometry->location->lng
    );

    return $latitude_longitude;
}