How can I search places with specific types using Google Places API?

此生再无相见时 提交于 2019-12-10 04:06:28

问题


I am using google place api to search specific types like(gas_station,cafes,shopping_malls etc...) here is link i am using https://maps.googleapis.com/maps/api/place/search/json?location=41.104805,29.024291&radius=50000&types=gas_station&sensor=false&key=AIzaSyAhVKOOLN1lx6iKKnbXMT82W1cKG7O8cDY

so here i need to search all gas_stations nearby my location so here i get "

results" : [],
   "status" : "ZERO_RESULTS"

But in my location some gas_stations are there(i search google map) so how can i get these results can any one help me..

Thanks for advance.


回答1:


The problem is with the categorization of the data. If you do a search for types=university you'll see a number of results. Now look at the types in those results - they're listed mostly as ["university", "establishment"].

All of the gas stations in the area are only categorized as ["establishment"], so they're not coming up in your search for gas_station.

You could use the keyword search to return businesses with "gas%20station" in their metadata. It seems to return the same results as searching for "gas station" around that area in Google Maps.



来源:https://stackoverflow.com/questions/8652543/how-can-i-search-places-with-specific-types-using-google-places-api

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