<br />

[Video](https://www.youtube.com/watch?v=YPI7L9d0q5s)

The Places Aggregate API is a service that provides insights about places within a
specified area based on criteria such as location, type, operating status, price
level, and user ratings. This service can help analyze the density of specific
[Place Types](https://developers.google.com/maps/documentation/places/web-service/place-types.md.txt) around a given location, and answer questions like "What, or
how many, 5-star rated $$$ restaurants are within a 5km radius of this
location?"

Results are returned as either aggregated counts or the identified place IDs in
the search area of interest. Users can use the [Place Details API](https://developers.google.com/maps/documentation/places/web-service/place-details.md.txt) to
retrieve more information about those Place IDs.

## Why use the Places Aggregate API

The Places Aggregate API empowers your users to make data-driven decisions based on
the comprehensive information you provide about various places. It leverages
accurate and up-to-date place models, which supports the following key use
cases:

- **Businesses**: Analyze competition and potential locations for new branches.
- **Developers**: Build applications that provide personalized recommendations.
- **Researchers**: Examine trends and patterns in specific areas.

## What you can do with the Places Aggregate API

With the Places Aggregate API, you can get the following information:

- **Counts**: Retrieve the number of places that match your criteria.
- **Places IDs** : Retrieve [Place IDs](https://developers.google.com/maps/documentation/places/web-service/place-id.md.txt) of specific places that match your criteria.

You can also use **filtering** to refine your search based on various attributes
such as place types, operating hours, price levels, and customer ratings.

> [!NOTE]
> **Note:** Place IDs are returned only if the `count` is 100 or lower.

## Examples

[Video](https://www.youtube.com/watch?v=icXd4jEROo8)

This section describes example uses case for Places Aggregate API and includes
working code for each example.

> [!TIP]
> **Tip:** The [Google Maps Platform Architecture Center](https://developers.google.com/maps/architecture) contains example use cases to help you build apps with Google Maps Platform. For an example using Places Aggregate API, see [Use Places Aggregate API to create a
> custom location score](https://developers.google.com/maps/architecture/places-aggregate-location-score). This score will instantly communicate how suitable a location is for your customer's needs.

### Opening a new cafe

A restaurant owner wants to open a new cafe. To do so, they first want to
visualize where the hotspots of cafes are so that they can identify areas of
high and low concentration to inform their business decision. The
Places Aggregate API can help analyze the number of cafes within a specific radius
based on attributes like operation status, price levels, and customer ratings to
make a data-backed decision on where to open their next location.

[View Sample](https://jsfiddle.net/29wufjrt/)

![A map of San Francisco and entertainment scores by zipcode.](https://developers.google.com/static/maps/documentation/places-aggregate/images/placesaggregate_heatmap.png)

### Real estate investment firm

A real estate investment firm wants to enhance their financial models and
accurately determine the ROI on their planned property investments. By using
the Places Aggregate API, they can gather detailed data on the amenities near
potential investment properties, such as ATMs, hospitals, transit stations, and
grocery stores, so that they can understand the amenities near potential
investment properties.

### Retail delivery service

When expanding into a new city, a retail delivery service needs to determine the
number of delivery drivers to allocate to a region based on the density of
popular consumer destinations, such as restaurants, convenience stores and
liquor stores. Using the API, the delivery service counts the total number of
these establishments throughout the city so that they can plan and allocate
resources effectively.

[View Sample](https://jsfiddle.net/yb7c9q23/)

![A heatmap of restaurants by volume in Mountain View.](https://developers.google.com/static/maps/documentation/places-aggregate/images/placesaggregate_vibrancy_score.png)

## How the Places Aggregate API works

The Places Aggregate API lets you specify filters to narrow your search criteria.
After you select an **Insight Type** of either `INSIGHT_COUNT` or
`INSIGHT_PLACES`, you can add filter criteria, including the following:

- **Location**: Define the area of interest using circles, regions, or custom polygons.
- **Type**: Specify the types of places you're interested in.
- **Operations Status**: Filter places based on their operational status.
- **Price levels**: Filter places based on price levels.
- **Ratings**: Filter places based on user ratings.

The API response [`ComputeInsightsResponse`](https://developers.google.com/maps/documentation/places-aggregate/reference/rest/v1/TopLevel/computeInsights.md.txt#response-body) object contains the results of
the request insight. For example, if you selected `INSIGHT_COUNT`, the response
contains a total number of places, and if you selected `INSIGHT_PLACES`, the
response contains a list of Place IDs.

## How to use the Places Aggregate API

|---|---|---|
| 1 | **Get set up.** | Start with [Set up your Google Cloud project](https://developers.google.com/maps/documentation/places-aggregate/cloud-setup) and complete the instructions that follow. |
| 2 | **Make a request to get the count of matching places.** | See [Make your first request](https://developers.google.com/maps/documentation/places-aggregate/make-your-first-request.md.txt). |
| 3 | **Learn about request parameters.** | See [Request parameters](https://developers.google.com/maps/documentation/places-aggregate/request-parameters.md.txt). |

## What's next

- [Review pricing and usage limits](https://developers.google.com/maps/documentation/places-aggregate/usage-and-billing.md.txt)
- [View the API reference](https://developers.google.com/maps/documentation/places-aggregate/reference/rest.md.txt)
- [Review the FAQ](https://developers.google.com/maps/documentation/places-aggregate/faq.md.txt)
- [Review support options](https://developers.google.com/maps/documentation/places-aggregate/support.md.txt)