Google Places API - Nearby Search not filtering by type

[亡魂溺海] 提交于 2019-12-24 11:19:26

问题


The following URL Request is not filtering places by their types:

https://maps.googleapis.com/maps/api/place/nearbysearch/json?type=establishment&location=-15.8374808,-48.0125697&radius=100&key=[YOUR_API_KEY_HERE]

The query string type=establishment is not filtering property.

Note: insert your Google API Key in the end for search.

Edit: I believe only the first result is not in the filtered type. It's the state.


回答1:


The establishment type is not in the list of supported types for place searches.

So your query is ignoring this type filter as if you were making the following typeless request:

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-15.8374808,-48.0125697&radius=100&key=KEY

You'll need to use a supported type such as e.g. store:

https://maps.googleapis.com/maps/api/place/nearbysearch/json?type=store&location=-15.8374808,-48.0125697&radius=100&key=KEY

Hope this helps!



来源:https://stackoverflow.com/questions/57826944/google-places-api-nearby-search-not-filtering-by-type

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