Google Places API INVALID_REQUEST with no types attribute

喜夏-厌秋 提交于 2019-12-10 19:59:11

问题


At least this one should be easy for you to verify. This request returns an INVALID_REQUEST:

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=51.509980,-0.133700&sensor=true&rankby=distance&key=[api_key]

But this one works (exactly the same but with a types parameter):

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=51.509980,-0.133700&sensor=true&rankby=distance&key=[api_key]&types=food

In the documentation it says that types is not a required parameter so is it a bug in their API?


回答1:


It is not a bug but an expected behaviour (inconsistent behaviour I believe but anyways). For those who are interested, I got my answer here: https://code.google.com/p/gmaps-api-issues/issues/detail?id=5456

  • distance. This option sorts results in ascending order by their distance from the specified location. Ranking results by distance will set a fixed search radius of 50km. One or more of keyword, name, or types is required.


来源:https://stackoverflow.com/questions/16826829/google-places-api-invalid-request-with-no-types-attribute

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