Places Aggregate API client libraries

This page shows how to get started with the client libraries for Places Aggregate API.

Read more about the client libraries in Client Libraries Explained.

Install the client library

Java

For more information, see Setting Up a Java Development Environment.

See Google Places Aggregate API Client for Java for the installation instructions.

Go

go get cloud.google.com/go/maps
For more information, see Setting Up a Go Development Environment.

See Google Places Aggregate API Client for Go for the installation instructions.

Node.js

npm install @googlemaps/areainsights
For more information, see Setting Up a Node.js Development Environment.

For the complete installation instructions, see Google Places Aggregate API Client for Node.js

Python

For more information, see Setting Up a Python Development Environment.

For the complete installation instructions, see Google Places Aggregate API Client for Python

.Net

For more information, see Setting Up a .Net Development Environment.

For the complete installation instructions, see Google Places Aggregate API Client for .Net

Setting up authentication

When you use client libraries, you use Application Default Credentials (ADC) to authenticate. For information about setting up ADC, see Provide credentials for Application Default Credentials. For information about using ADC with client libraries, see Authenticate using client libraries.

Use the client library

Java

import com.google.api.core.ApiFuture;
import com.google.maps.areainsights.v1.AreaInsightsClient;
import com.google.maps.areainsights.v1.ComputeInsightsRequest;
import com.google.maps.areainsights.v1.ComputeInsightsResponse;
import com.google.maps.areainsights.v1.Filter;
import com.google.maps.areainsights.v1.Insight;
import java.util.ArrayList;

public class AsyncComputeInsights {

  public static void main(String[] args) throws Exception {
    asyncComputeInsights();
  }

  public static void asyncComputeInsights() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (AreaInsightsClient areaInsightsClient = AreaInsightsClient.create()) {
      ComputeInsightsRequest request =
          ComputeInsightsRequest.newBuilder()
              .addAllInsights(new ArrayList<Insight>())
              .setFilter(Filter.newBuilder().build())
              .build();
      ApiFuture<ComputeInsightsResponse> future =
          areaInsightsClient.computeInsightsCallable().futureCall(request);
      // Do something.
      ComputeInsightsResponse response = future.get();
    }
  }
}

Go

// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Code generated by protoc-gen-go_gapic. DO NOT EDIT.

package areainsights_test

import (
	"context"

	areainsights "cloud.google.com/go/maps/areainsights/apiv1"
	areainsightspb "cloud.google.com/go/maps/areainsights/apiv1/areainsightspb"
)

func ExampleNewClient() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := areainsights.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func ExampleNewRESTClient() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := areainsights.NewRESTClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func ExampleClient_ComputeInsights() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := areainsights.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &areainsightspb.ComputeInsightsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/maps/areainsights/apiv1/areainsightspb#ComputeInsightsRequest.
	}
	resp, err := c.ComputeInsights(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Node.js

/**
 * This snippet has been automatically generated and should be regarded as a code template only.
 * It will require modifications to work.
 * It may require correct/in-range values for request initialization.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. Insights to compute. Currently only INSIGHT_COUNT and
 *  INSIGHT_PLACES are supported.
 */
// const insights = [1,2,3,4]
/**
 *  Required. Insight filter.
 */
// const filter = {}

// Imports the Areainsights library
const {AreaInsightsClient} = require('@googlemaps/areainsights').v1;

// Instantiates a client
const areainsightsClient = new AreaInsightsClient();

async function callComputeInsights() {
  // Construct request
  const request = {
    insights,
    filter,
  };

  // Run request
  const response = await areainsightsClient.computeInsights(request);
  console.log(response);
}

callComputeInsights();

Python

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.maps import areainsights_v1


async def sample_compute_insights():
    # Create a client
    client = areainsights_v1.AreaInsightsAsyncClient()

    # Initialize request argument(s)
    request = areainsights_v1.ComputeInsightsRequest(
        insights=['INSIGHT_PLACES'],
    )

    # Make the request
    response = await client.compute_insights(request=request)

    # Handle the response
    print(response)

.Net

using Google.Maps.AreaInsights.V1;
using System.Threading.Tasks;

public sealed partial class GeneratedAreaInsightsClientSnippets
{
    /// <summary>Snippet for ComputeInsightsAsync</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public async Task ComputeInsightsRequestObjectAsync()
    {
        // Create client
        AreaInsightsClient areaInsightsClient = await AreaInsightsClient.CreateAsync();
        // Initialize request argument(s)
        ComputeInsightsRequest request = new ComputeInsightsRequest
        {
            Insights =
            {
                Insight.Unspecified,
            },
            Filter = new Filter(),
        };
        // Make the request
        ComputeInsightsResponse response = await areaInsightsClient.ComputeInsightsAsync(request);
    }
}

Additional resources