How to find only school results in google autocomplete api?

回眸只為那壹抹淺笑 提交于 2019-12-20 06:37:14

问题


I want to search only schools in google autocomplete api. I have tried but it does not filter the search specific to schools only. I have read from below url

https://developers.google.com/places/web-service/autocomplete

But it has only types parameters for filtering results.

I am able to search only schools in google nearby places search but it requires me to send lat, long but I want to search all schools despite of any location.


回答1:


At present time Places API autocomplete doesn't support filtering by types like school, restaurant, etc.

There is a feature request in Google issue tracker to make it possible filter autocomplete by types that are supported in Places API searches:

https://issuetracker.google.com/issues/35820774

As you can see the feature request was filed in 2011. Unfortunately, it looks like Google didn't set a high priority on this task. I would suggest starring the feature request to add your vote. Hopefully Google will implement it one day.




回答2:


This is what I found working for me. It is not ideal, but better than nothing

https://maps.googleapis.com/maps/api/place/textsearch/json?key=MY-APP-KEY&query=shaheen%20public&types=school




回答3:


You can use

https://maps.googleapis.com/maps/api/place/textsearch/json?key=MY-APP-KEY&query=shaheen%20public&types=school

Read more about supported types here.

https://developers.google.com/places/supported_types?csw=1



来源:https://stackoverflow.com/questions/52215276/how-to-find-only-school-results-in-google-autocomplete-api

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