28

Whats the difference between a nearby Search and a text Search in Google Places API?

For example, a nearby Search for cafe within a radius of 1km returns only 1 result using https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-41.319282,174.818717&radius=1000&sensor=true&types=cafe&key=your_api_key

while text Search for cafe within a radius of 1km returns 20 results using https://maps.googleapis.com/maps/api/place/textsearch/json?location=-41.319282,174.818717&radius=1000&sensor=true&query=cafe&key=your_api_key.

Changing types to type in the nearby search also returns 20 results which are also different to the result found using the text search above. ie https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-41.319282,174.818717&radius=1000&sensor=true&type=cafe&key=your_api_key

When you do a search for cafe on google maps android app using the location given above, the result you get is the same as the result you get by using the text search above.

For convenience, the above clickable links are below.

https://maps.googleapis.com/maps/api/place/textsearch/json?location=-41.319282,174.818717&radius=1000&sensor=true&query=cafe&key=

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-41.319282,174.818717&radius=1000&sensor=true&type=cafe&key=

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-41.319282,174.818717&radius=1000&sensor=true&types=cafe&key=

GKK
  • 232
  • 1
  • 3
  • 15
Ishan
  • 3,931
  • 11
  • 37
  • 59
  • 3
    Ishan, while I appreciate you including click-able links to provide real examples, it is probably not the best idea to let everyone know your API key. – Craig B Mar 21 '14 at 05:11
  • hii this api is not provide other information like phone,email etc so what change is required for getting this detail – Mahesh Mar 22 '14 at 09:43

1 Answers1

9

Simply put nearby places allows you to search more vaguely but only return specific results. In Text Search, if you search for "restaurants", it will search for locations, establishments or names with the text "restaurants".Anything that is related to restaurants. Meanwhile in nearby search, if you search for "restaurants", it will return restaurant establishments with or without the text "restaurants" but only establishments of "restaurants"

Alfred
  • 109
  • 5
  • 3
    Request limitations are also much different - nearby place search uses (as expected) 1 request, whereas text searches use 10x the requests. Cumbersome but expected as a text search looks through many more parameters. – Will Von Ullrich May 01 '17 at 15:58