Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Places API INVALID_REQUEST with no types attribute

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?

like image 831
chopchop Avatar asked Mar 24 '23 19:03

chopchop


1 Answers

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.
like image 133
chopchop Avatar answered Apr 01 '23 13:04

chopchop