retrieve points of interests (attractions/tourist places) of a place/country using google places api

ε祈祈猫儿з 提交于 2019-11-27 04:28:40

问题


I want to retrieve points of interests of a place/country through google places api say 'points of interests in london'. I want the results to be same as I google search it like [here][1. I've used something like this

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

where lat,long are respective latitude,longitude of that place/country.

But the resulting json file does not retrieve points of interests of that place rather it just outputs nearby places.

i also tried this

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

which ended up in same results

is there any option to do it without using radius parameter

please do help me


回答1:


Try this google places API url. You will get the point of interest/Attraction/Tourists places in (For Eg:) New York City. You have to use the CITY NAME with the keyword Point Of Interest

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

These API results are same as the results of the below google search results.

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




回答2:


Try this google place API url. https://maps.googleapis.com/maps/api/place/textsearch/json?query=point+of+interest+in+cityName&key=API_KEY




回答3:


It looks like you may be looking for an API that surfaces Google Search results, and there is one: Google Custom Search https://developers.google.com/custom-search/docs/overview

You could use Nearby or Radar search, if you'd be looking for more specific, supported types: https://developers.google.com/places/supported_types#table1




回答4:


Please tied to use google API

  1. Step 1 : Create Google API key Get API Key
  2. Step 2: Add Places API
  3. Step 3: Implement

$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);


来源:https://stackoverflow.com/questions/37874018/retrieve-points-of-interests-attractions-tourist-places-of-a-place-country-usi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!