How to get all places (or specific type of place such as a restaurant) in a city or country with Google Places API?

Marcus Johnson picture Marcus Johnson · Dec 25, 2012 · Viewed 30.3k times · Source

I am trying to find all "restaurants" or "insurance agencies" for example, in a city or country. Okay, maybe a country is too broad but mainly large cities.

I am using the Google Places API and python but I see that you can only use a "radius" parameter or "rankby=distance". The problem is that, according to the docs, I believe that each query can only return 20 results on 3 pages, or 60 results (correct me if I am wrong). So if I wanted to find all the restaurants in New York for example, I would have to start at the center or something and set "rankby=distance" so that it would give me the 60 closest results within a set radius. But then I don't know what my next query would be...

Any ideas how to go about doing this?

Answer

user1419445 picture user1419445 · Dec 30, 2012

Unfortunately you can't get more than 60 results from the Google Places API; at least not without breaking the terms of service:

Unless you have received prior written authorization from Google (or, as applicable, from the provider of particular Content), you must not: (d) use the Products in a manner that gives you or any other person access to mass downloads or bulk feeds of any Content, including but not limited to numerical latitude or longitude coordinates, imagery, and visible map data

Furthermore, as you can read here:

It's in large part a licensing issue. But it's also because the goal of the Places API is not to facilitate scraping or aggregation of Google Places data in the way you describe. Any application that does so is almost certainly not compliant with the Google Maps or Google Maps API Terms of Service, and is likely to be blocked from using the API or other Google services at any time. The Places API is intended to allow apps to offer their users a way to discover of identify Places nearby. There is a practical limit to the number of search results that a user will scan through and consider. I don't believe it's necessary to offer users 200 results, and I suspect that doing so would only serve to increase development of applications that scrape Google Places data, without adding significant benefit or utility to the types of apps the API is intended to serve, and that we wish to encourage.

As a further reference, have also a look at this answer.