Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Check Every Business Location on Google Maps with Places API

· 6 min read · Home Tech

In this article
  1. Background: What the Places API Can and Can't Do
  2. How the API Works: Pagination and Search Grids
  3. Choosing the Right Endpoint and Parameters
  4. Common Problems and How to Solve Them
  5. Costs and Quotas: What to Expect
  6. Alternatives and Complementary Tools
  7. Best Practices for Thorough Coverage
  8. Frequently Asked Questions

Yes, you can check every business location on Google Maps using the Places API, but it requires a systematic approach because the API doesn't return all businesses in one call. You'll use the Nearby Search or Text Search endpoints to retrieve businesses within a defined area, then paginate through results and repeat for overlapping grids to cover a region.

Background: What the Places API Can and Can't Do

The Google Places API is a set of endpoints that return information about places—businesses, landmarks, and other points of interest. The most relevant for checking business locations are:

  • Nearby Search: Finds places within a specified radius of a latitude/longitude point. You can filter by type (e.g., restaurant, store) and rank by prominence or distance.
  • Text Search: Returns places matching a text query (e.g., "coffee shops in Chicago").
  • Place Details: Gives full information about a specific place using its place_id.
  • Find Place: A lighter version of Text Search, good for single queries.

Key limitations: The API does not provide a "list all businesses in the world" endpoint. It returns up to 60 results per query (20 per page, with up to 3 pages for Nearby Search). Also, results are biased toward places that are well-known or have been claimed by owners; some small or new businesses may not appear.

How the API Works: Pagination and Search Grids

To check every business location in a city or region, you must break the area into smaller searchable pieces. The process:

  1. Define a boundary (e.g., a city's bounding box).
  2. Divide it into a grid of smaller circles. The maximum radius for Nearby Search is 50,000 meters, but for thorough coverage, use smaller radii (e.g., 1,000–2,000 meters) to avoid missing places due to the 60-result limit.
  3. For each grid center, call the Nearby Search endpoint with a type (e.g., "establishment" or a specific category).
  4. Collect the next_page_token from the response and wait a short delay (usually 2 seconds) before requesting the next page, until no more tokens are returned.
  5. Store the results, deduplicate by place_id, and move to the next grid cell.

Because the API has a 60-result cap per search, a dense urban area will require smaller grid cells. For example, a 10×10 km city with a 1 km radius grid would need about 100 cells—but overlapping cells are necessary to catch places near boundaries.

Choosing the Right Endpoint and Parameters

Your choice depends on what you mean by "every business."

  • Nearby Search is best when you want all places of a certain type within a radius. Use type=establishment to get a broad mix, but note that this includes non-business places like parks.
  • Text Search is useful when you have a specific category or name pattern (e.g., "dentist in Austin"). It also returns up to 60 results per query.
  • Place Details is necessary to get full address, phone, hours, and other fields for each place returned by the search endpoints.

Important parameters:

  • radius: in meters, max 50,000 for Nearby Search.
  • type: use the list of supported types (e.g., cafe, gym).
  • keyword: narrows results by name or category.
  • pagetoken: for pagination.

Remember that the API does not support a "country" or "city" parameter directly; you must supply coordinates.

Common Problems and How to Solve Them

Several issues arise when trying to check every business:

  • Missing places: Not all businesses are in Google's database. Some are not claimed by owners, and Google's algorithm may exclude very small or new ones. To mitigate, use multiple search types and keywords, and consider combining with other data sources.
  • Duplicate results: Overlapping grid cells will return the same place multiple times. Always deduplicate by place_id.
  • Rate limits and quotas: The Places API has a free tier (currently $200 credit per month) and charges per request. A large grid can consume thousands of requests, leading to costs. You must also handle OVER_QUERY_LIMIT errors with exponential backoff.
  • Incomplete data: Some places may lack phone numbers or hours. The Place Details response includes a business_status field (OPERATIONAL, CLOSED_TEMPORARILY, etc.)—use it to filter out permanently closed businesses.

Costs and Quotas: What to Expect

Each call to Nearby Search, Text Search, or Place Details counts as one request. The pricing is per request, not per result. As of 2024, the cost is $0.032 per request for Nearby Search and Text Search, and $0.017 for Place Details. The free monthly credit of $200 covers about 6,250 search requests or 11,764 details requests. For a small town with 1,000 businesses, you might need 100 search requests (if each returns 60) plus 1,000 details requests—well within the free tier. But for a large city with millions of businesses, costs can escalate quickly. Always estimate your grid size and result density before starting.

Alternatives and Complementary Tools

The Places API is not the only way to get business locations from Google Maps:

  • Google Maps JavaScript API: Allows you to embed maps and search within a web page, but it still uses the same backend and limits.
  • Google Places API (New): The newer version has different endpoints and pricing, but the logic is similar.
  • Web scraping: Not recommended—it violates Google's Terms of Service and can lead to IP bans. The API is the legitimate route.
  • Other data providers: Companies like Foursquare, Yelp, or OpenStreetMap offer their own APIs. OpenStreetMap is free and has a comprehensive database, though it may lack some business details.

For most use cases, a combination of the Places API and OpenStreetMap data can give you more complete coverage.

Best Practices for Thorough Coverage

To maximize the chance of catching every business:

  • Use a grid cell radius of 1,000 meters or less in urban areas, 2,000–5,000 meters in rural areas.
  • Search with multiple types (e.g., restaurant, store, health) rather than just establishment, because some businesses may be classified under specific types.
  • Combine Nearby Search with Text Search for the same area using generic terms like "business" or "shop".
  • Run the search at different times of day, as Google's index may update.
  • Store results in a database with a unique constraint on place_id.

Frequently Asked Questions

Can I get all businesses in a country with one API call?
No. The API does not have a country-level search. You must break the country into a grid and make many calls.

How many results can I get per search?
Up to 60 for Nearby Search (3 pages of 20). Text Search also returns up to 60.

Does the API include businesses that are permanently closed?
Yes, it may return them, but the Place Details response includes a business_status field. You can filter out those with status CLOSED_PERMANENTLY.

Is it legal to scrape Google Maps for business data?
No. Scraping violates Google's Terms of Service. Using the official API is the legal method.

How much does it cost to check a city like New York?
New York has roughly 200,000 businesses. With a 1 km grid, you'd need about 800 search calls (each returning 60) plus 200,000 details calls. That's about 800*$0.032 + 200,000*$0.017 = $3,425.60, well above the free tier.

Can I use the Places API to get business hours and phone numbers?
Yes, the Place Details endpoint returns those fields if available.