Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Obtaining more than 20 results with Google Places API

I want to develop a map application which will display the banks near a given place.

I use the Places library to search and everytime it just return 20 results. What should I do if I want more results?

like image 645
Demon Avatar asked Aug 06 '11 09:08

Demon


People also ask

How do I get more than 5 reviews on Google Places API?

In order to have access to more than 5 reviews with the Google API you have to purchase Premium data Access from Google. That premium plan will grant you access to all sorts of additional data points you have to shell out a pretty penny.

How do I get a list of places on Google Maps API?

Go to the Google Cloud Console. Click the Select a project button, then select the same project you set up for the Maps JavaScript API and click Open. From the list of APIs on the Dashboard, look for Places API. If you see the Places API in the list, it's already enabled.

What is the daily limit for Google Maps API?

While there is no maximum number of requests per day, the following usage limits are in place for the Maps JavaScript API: 30,000 requests per minute. 300 requests per minute per IP address. In the Google Cloud Console, this quota is referred to as Map loads per minute per user.

Is Google Places API free?

Places API is not free, however, once you set up your billing account, you will be entitled for a one time $300 free credit(usable for Google Cloud Platform products) and a monthly recurring $200 free credit(exclusive for Google Maps Platform products), after consuming the credits, you will receive an OVER_QUERY_LIMIT ...


2 Answers

UPDATE: Since I originally wrote this answer, the API was enhanced, making this answer out of date (or, at least, incomplete). See How to get 20+ result from Google Places API? for more information.

ORIGINAL ANSWER:

The documentation says that the Places API returns up to 20 results. It does not indicate that there is any way to change that limit. So, the short answer seems to be: You can't.

Of course, you might be able to sort of fake it by doing queries for several locations, and then merging/de-duplicating the results. It's kind of a cheap hack, though, and might not work very well. And I'd check first to make sure it doesn't violate the terms of service.

like image 135
Trott Avatar answered Oct 06 '22 10:10

Trott


Now it is possible to have more than 20 results (but up to 60), a parameter page_token was added to the API.

Returns the next 20 results from a previously run search. Setting a page_token parameter will execute a search with the same parameters used previously — all parameters other than page_token will be ignored.

Also you can refer to the accessing additional results section to see an example on how to do the pagination.

like image 24
Eduardo Avatar answered Oct 06 '22 08:10

Eduardo