使用google places api检索某个地方/国家/地区的兴趣点(景点/旅游景点)

时间:2016-06-17 05:48:47

标签: json google-maps google-maps-api-3 google-places-api

我想通过google places api说'伦敦的兴趣点'来检索某个地方/国家/地区的兴趣点。我希望结果与我谷歌搜索时的结果相同[这里] [1。我用过这样的东西

'https://maps.googleapis.com/maps/api/place/radarsearch/json?location='+str(lat)+','+str(long)+'&radius=500&type=tourist&rankby=prominence&key=API_KEY')

其中lat,long分别是该地方/国家的纬度,经度。

但是生成的json文件不会检索该地点的兴趣点,而只是输出附近的地方。

我也试过这个

'https://maps.googleapis.com/maps/api/place/nearbysearch/json?location='+str(lat)+','+str(long)+'&radius=500&type=tourist&&rankby=prominence&key=API_KEY'

最终得到了相同的结果

是否可以选择不使用radius参数

请帮帮我

5 个答案:

答案 0 :(得分:12)

试试这个google places API网址。您将获得兴趣点/景点/游客的地点(For Eg :) 纽约市。您必须将 CITY NAME 与关键字兴趣点

一起使用
https://maps.googleapis.com/maps/api/place/textsearch/json?query=new+york+city+point+of+interest&language=en&key=API_KEY

这些API结果与以下Google搜索结果的结果相同。

https://www.google.com/search?sclient=psy-ab&site=&source=hp&btnG=Search&q=New+York+point+of+interest

答案 1 :(得分:1)

答案 2 :(得分:1)

我从事了一个广泛使用此功能的项目。最后,获得城市景点的最佳方法是使用类似以下的查询:

https://maps.googleapis.com/maps/api/place/autocomplete/json?input=your-query-here&types=establishment&location=37.76999,-122.44696&radius=500&key=YOUR_API_KEY

如果您想要的景点不是企业,请删除types=establishment参数。

答案 3 :(得分:0)

看起来您可能正在寻找能够显示Google搜索结果的API,而且还有一个:Google自定义搜索https://developers.google.com/custom-search/docs/overview

如果您要查找更具体,受支持的类型,可以使用附近或雷达搜索:https://developers.google.com/places/supported_types#table1

答案 4 :(得分:0)

请绑定使用Google API

  1. 第1步: 创建Google API密钥Get API Key
  2. 第2步:添加Places API
  3. 第3步:实施

$url= "https://maps.googleapis.com/maps/api/place/textsearch/json?query=dubai+point+of+interest&language=en&radius=2000&key=API_KEY";

$json=file_get_contents($url);

$obj = json_decode($json);

print_r($obj);
相关问题