6

I want to search all cafe and restaurants in New York. Of course, I can use Text Search, as it recommended here - Google Places API Search for Keyword and City

But if I do a request like https://maps.googleapis.com/maps/api/place/textsearch/json?query=cafe+New+York+food&sensor=false&key=MY_KEY

First element, which I got, is

"formatted_address" : "316 Victoria Avenue, Chatswood NSW, Australia",

really no way to filter data by city? This data exists in address, why no good way to filter by city, only via keywords?

Community
  • 1
  • 1
Oleg Sh
  • 8,496
  • 17
  • 89
  • 159

1 Answers1

6

You can add a location parameter to your query (requires also to specify the radius).

so your query would look like :

https://maps.googleapis.com/maps/api/place/textsearch/json?query=cafe+New+York+food&sensor=false&location=40.67,-73.94&radius=100&key=YOUR_KEY

see the full documentation here : https://developers.google.com/places/documentation/search#TextSearchRequests

yonili
  • 703
  • 5
  • 18