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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With