Google places api restaurant types

风流意气都作罢 提交于 2019-11-30 13:43:58

问题


When you search for a restaurant in Google places and go to the business profile (i.e.: https://plus.google.com/107507038669791289691/about?hl=en) the restaurant has a tag (in this case Mexican Restaurant). But when using the Google places api all I can see is a types list

"types" : [ "restaurant", "food", "establishment" ]

Anyone know if it's possible to get the tag "Mexican Restaurant" somehow?

I know about the supported types (https://developers.google.com/places/documentation/supported_types). It is not super helpful.


回答1:


I think you would probably have to revert to the text search method on the api..

https://developers.google.com/places/documentation/search#TextSearchRequests

So your request would end up looking something like the below, restricted down to a specific area

https://maps.googleapis.com/maps/api/place/textsearch/json?query=Mexican+Restaurant&sensor=true&location=40.846,-73.938&radius=20&key=yourKeyHere

However this will return all other Mexican restaurants in the area, so if you just want to return the one result I would use the Place Details request instead.




回答2:


I was also working in a project which need to get more details about a place using Google Maps and Google Places APIs, and I really spent many hours trying to find something that can help ( Google Places API, Google Maps API, google+ APIs, ... ) but nothing ... the only things that I found is theses 2 issues ( feature requests ) which I hope that Google will add to their APIs someday :

  • Issue N° 5260 with 13 stars.

  • Issue N°7878 with 4 stars.

I hope with this SO question that we get more interested persons to get the feature in a soon future version of Google Map or Google Places APIs.

For the Google Places for Work API, I didn't find any information to confirm or not that it contains such feature, but I don't think so.

Hope that can help.




回答3:


Separate your place types by PIPE symbol "|"

try like this :

String types = "cafe|restaurant|museum" // Listing places only cafes, restaurants and museums.



来源:https://stackoverflow.com/questions/16023571/google-places-api-restaurant-types

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