How to get 20+ result from Google Places API?

Scorpion picture Scorpion · Mar 8, 2012 · Viewed 54.8k times · Source

I am developing an app in which I am getting the list of ATM's near by the user. For that I am using Google Places API, but every time it returns 20 result only. I want to get more results. In the API doc it is mention that it will return 20 result but I would like to know is there any way I can get more data or I have to create my own database for that?
Also what I found in the API is that it does not have all the ATM's for India. The information is also not accurate for some of the locations. So Please suggest me some idea for that I should use my own database or not?
I know that I can register places in the Google Places but there is the problem that every time it returns only 20 result. If anyhow this problem is resolved then it will be great to use the Places API..

Please kindly help me.....

Answer

Chris Green picture Chris Green · Mar 9, 2012

As per the documentation:

https://developers.google.com/places/web-service/search#PlaceSearchResponses

EDIT: Place API now supports pagination of up to 60 results. See below for details.

The Places API will return up to 20 establishments per query; however, each search can return as many as 60 results, split across three pages. If your search will return more than 20, then the search response will include an additional parameter — next_page_token. Pass the value of next_page_token to the page_token parameter of a new place search to see the next set of 20 results.

There is also strict terms of service that specify you cant Pre-Fetch, Cache, or Store Content unless it is the content identifier or key you are permitted to store i.e. reference token from a places search:

https://cloud.google.com/maps-platform/terms/?_ga=#3-license

In regards to not being able to find ATM's in India. All places are categorized under the type establishment until Google has enough metadata about a place to categorize it under more specific place types like ATM, cafe, bar etc. A work around that may find more results is to use the keyword parameter in your request with something like 'ATM', 'bank' or 'finance' as the value. As per the documentation:

https://developers.google.com/places/web-service/search#PlaceSearchRequests

The keyword parameter is matched against all available fields, including but not limited to name, type, and address, as well as customer reviews and other third-party content.