> ## AI Agent Context
> Get the complete documentation index at: https://aistudio.google.com/llms.txt
> Use this file to discover all available pages.
> For the full documentation in a single file, fetch: https://aistudio.google.com/llms-full.txt

# Grounding with Google Maps

Grounding with Google Maps connects the generative capabilities of Gemini with
the rich, factual, and up-to-date data of Google Maps. This feature enables
developers to easily incorporate location-aware functionality into their
applications. When a user query has a context related to Maps data, the Gemini
model leverages Google Maps to provide factually accurate and fresh answers that
are relevant to the user's specified location or general area.

*   **Accurate, location-aware responses:** Leverage Google Maps' extensive and
  current data for geographically specific queries.

*   **Enhanced personalization:** Tailor recommendations and information based
  on user-provided locations.


## Get started  {% id="get-started" %}

This example demonstrates how to integrate Grounding with Google Maps into your
application to provide accurate, location-aware responses to user queries. The
prompt asks for local recommendations with an optional user location, enabling
the Gemini model to use Google Maps data.

{% tabs %}
  {% tab label="Python" %}
  ```python
  # This will only work for SDK newer than 2.0.0
  from google import genai
  
  client = genai.Client()
  
  interaction = client.interactions.create(
      model="gemini-3.8-flash",
      input="What are the best Italian restaurants within a 15-minute walk from here?",
      tools=[{
          "type": "google_maps",
          "latitude": 34.050481,
          "longitude": -118.248526
      }]
  )
  
  # Print the model's text response and annotations
  for step in interaction.steps:
      if step.type == "model_output":
          for content_block in step.content:
              if content_block.type == "text":
                  print(content_block.text)
                  if content_block.annotations:
                      print("\nSources:")
                      for annotation in content_block.annotations:
                          if annotation.type == "place_citation":
                              print(f" - {annotation.name}: {annotation.url}")
  ```

  {% /tab %}

  {% tab label="JavaScript" %}
  ```javascript
  // This will only work for SDK newer than 2.0.0
  import { GoogleGenAI } from "@google/genai";
  
  const ai = new GoogleGenAI({});
  
  async function main() {
    const interaction = await ai.interactions.create({
      model: "gemini-3.8-flash",
      input: "What are the best Italian restaurants within a 15-minute walk from here?",
      tools: [{
        type: "google_maps",
        latitude: 34.050481,
        longitude: -118.248526
      }]
    });
  
    // Print the model's text response and annotations
    for (const step of interaction.steps) {
      if (step.type === 'model_output') {
        for (const contentBlock of step.content || []) {
          if (contentBlock.type === 'text') {
            console.log(contentBlock.text);
            if (contentBlock.annotations) {
              console.log("\nSources:");
              for (const annotation of contentBlock.annotations) {
                if (annotation.type === 'place_citation') {
                  console.log(` - {annotation.name}: {annotation.url}`);
                }
              }
            }
          }
        }
      }
    }
  }
  
  await main();
  ```

  {% /tab %}

  {% tab label="Java" %}
  ```java
  import com.google.genai.Client;
  import com.google.genai.gaos.models.interactions.Annotation;
  import com.google.genai.gaos.models.interactions.Content;
  import com.google.genai.gaos.models.interactions.CreateModelInteraction;
  import com.google.genai.gaos.models.interactions.GoogleMaps;
  import com.google.genai.gaos.models.interactions.Interaction;
  import com.google.genai.gaos.models.interactions.InteractionsInput;
  import com.google.genai.gaos.models.interactions.Model;
  import com.google.genai.gaos.models.interactions.ModelOutputStep;
  import com.google.genai.gaos.models.interactions.PlaceCitation;
  import com.google.genai.gaos.models.interactions.Step;
  import com.google.genai.gaos.models.interactions.TextContent;
  import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
  import java.util.Arrays;
  
  Client client = new Client();
  
  CreateModelInteraction params =
      CreateModelInteraction.builder()
          .model(Model.of("gemini-3.8-flash"))
          .input(
              InteractionsInput.of(
                  "What are the best Italian restaurants within a 15-minute walk from here?"))
          .tools(
              Arrays.asList(
                  GoogleMaps.builder().latitude(34.050481).longitude(-118.248526).build()))
          .build();
  
  Interaction interaction =
      client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();
  
  // Print the model's text response and annotations
  if (interaction.steps().isPresent()) {
    for (Step step : interaction.steps().get()) {
      if (step instanceof ModelOutputStep) {
        ModelOutputStep outputStep = (ModelOutputStep) step;
        if (outputStep.content().isPresent()) {
          for (Content contentBlock : outputStep.content().get()) {
            if (contentBlock instanceof TextContent) {
              TextContent textContent = (TextContent) contentBlock;
              System.out.println(textContent.text().orElse(""));
              if (textContent.annotations().isPresent()
                  && !textContent.annotations().get().isEmpty()) {
                System.out.println("\nSources:");
                for (Annotation annotation : textContent.annotations().get()) {
                  if (annotation instanceof PlaceCitation) {
                    PlaceCitation citation = (PlaceCitation) annotation;
                    System.out.printf(
                        "  - %s: %s%n", citation.name().orElse(""), citation.url().orElse(""));
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  ```

  {% /tab %}

  {% tab label="Go" %}
  ```go
  package main
  
  import (
      "context"
      "fmt"
      "log"
  
      "google.golang.org/genai"
      "google.golang.org/genai/interactions/models/interactions"
      "google.golang.org/genai/interactions/models/operations"
  )
  
  func main() {
      ctx := context.Background()
      client, err := genai.NewClient(ctx, nil)
      if err != nil {
          log.Fatal(err)
      }
  
      resp, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{
          Body: operations.NewCreateInteractionRequestBody(
              interactions.CreateModelInteraction{
                  Model: interactions.Model("gemini-3.8-flash"),
                  Input: interactions.NewInteractionsInput("What are the best Italian restaurants within a 15-minute walk from here?"),
                  Tools: []interactions.Tool{
                      interactions.NewTool(interactions.GoogleMaps{
                          Latitude:  genai.Ptr(34.050481),
                          Longitude: genai.Ptr(-118.248526),
                      }),
                  },
              },
          ),
      })
      if err != nil {
          log.Fatal(err)
      }
  
      // Print the model's text response and annotations
      for _, step := range resp.Interaction.Steps {
          if step.ModelOutputStep != nil {
              for _, content := range step.ModelOutputStep.Content {
                  if content.TextContent != nil {
                      fmt.Println(content.TextContent.Text)
                      if len(content.TextContent.Annotations) > 0 {
                          fmt.Println("\nSources:")
                          for _, annotation := range content.TextContent.Annotations {
                              if annotation.PlaceCitation != nil {
                                  c := annotation.PlaceCitation
                                  name := ""
                                  if c.Name != nil {
                                      name = *c.Name
                                  }
                                  url := ""
                                  if c.URL != nil {
                                      url = *c.URL
                                  }
                                  fmt.Printf("  - %s: %s\n", name, url)
                              }
                          }
                      }
                  }
              }
          }
      }
  }
  ```

  {% /tab %}

  {% tab label="REST" %}
  ```shell
  # Specifies the API revision to avoid breaking changes when they become default
  curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
    -H "x-goog-api-key: $GEMINI_API_KEY" \
    -H 'Content-Type: application/json' \
    -H "Api-Revision: 2026-05-20" \
    -d '{
      "model": "gemini-3.8-flash",
      "input": "What are the best Italian restaurants within a 15-minute walk from here?",
      "tools": [{
        "type": "google_maps",
        "latitude": 34.050481,
        "longitude": -118.248526
      }]
    }'
  ```

  {% /tab %}

{% /tabs %}

## How Grounding with Google Maps works  {% id="how-it-works" %}

Grounding with Google Maps integrates the Gemini API with the Google Geo
ecosystem by using the Maps API as a grounding source. When a user's query
contains geographical context, the Gemini model can invoke the Grounding with
Google Maps tool. The model can then generate responses grounded in Google Maps
data relevant to the provided location.

The process typically involves:

1.   **User query:** A user submits a query to your application, potentially
  including geographical context (e.g., "coffee shops near me," "museums in
  San Francisco").

2.   **Tool invocation:** The Gemini model, recognizing the geographical intent,
  invokes the Grounding with Google Maps tool. This tool can optionally be
  provided with the user's `latitude` and `longitude`. The tool is a textual
  search tool and behaves similarly to searching on Maps, in that local
  queries ("near me") will use the coordinates, while specific or non-local
  queries are unlikely to be influenced by the explicit location.

3.   **Data retrieval:** The Grounding with Google Maps service queries Google
  Maps for relevant information (e.g., places, reviews, photos, addresses,
  opening hours).

4.   **Grounded generation:** The retrieved Maps data is used to inform the
  Gemini model's response, ensuring factual accuracy and relevance.

5.   **Response & annotations:** The model returns a text response with inline
  annotations linking to Google Maps sources, allowing developers to
  display citations.


## Why and when to use Grounding with Google Maps  {% id="why-use" %}

Grounding with Google Maps is ideal for applications that require accurate,
up-to-date, and location-specific information. It enhances the user experience
by providing relevant and personalized content backed by Google Maps' extensive
database of over 250 million places worldwide.

You should use Grounding with Google Maps when your application needs to:

*   Provide complete and accurate responses to geo-specific questions.

*   Build conversational trip planners and local guides.

*   Recommend points of interest based on
  location and user preferences like restaurants or shops.

*   Create location-aware experiences for social, retail, or food delivery
  services.


Grounding with Google Maps excels in use cases where proximity and current
factual data are critical, such as finding the "best coffee shop near me" or
getting directions.

## Use cases  {% id="use-cases" %}

Grounding with Google Maps supports a variety of location-aware use cases.

### Handling place-specific questions  {% id="place-specific" %}

Ask detailed questions about a specific place to get answers based on Google
user reviews and other Maps data.

{% tabs %}
  {% tab label="Python" %}
  ```python
  # This will only work for SDK newer than 2.0.0
  from google import genai
  
  client = genai.Client()
  
  interaction = client.interactions.create(
      model="gemini-3.8-flash",
      input="Is there a cafe near the corner of 1st and Main that has outdoor seating?",
      tools=[{
          "type": "google_maps",
          "latitude": 34.050481,
          "longitude": -118.248526
      }]
  )
  
  for step in interaction.steps:
      if step.type == "model_output":
          for content_block in step.content:
              if content_block.type == "text":
                  print(content_block.text)
                  if content_block.annotations:
                      print("\nSources:")
                      for annotation in content_block.annotations:
                          if annotation.type == "place_citation":
                              print(f" - {annotation.name}: {annotation.url}")
  ```

  {% /tab %}

  {% tab label="JavaScript" %}
  ```javascript
  // This will only work for SDK newer than 2.0.0
  import { GoogleGenAI } from "@google/genai";
  
  const ai = new GoogleGenAI({});
  
  async function main() {
    const interaction = await ai.interactions.create({
      model: "gemini-3.8-flash",
      input: "Is there a cafe near the corner of 1st and Main that has outdoor seating?",
      tools: [{
        type: "google_maps",
        latitude: 34.050481,
        longitude: -118.248526
      }]
    });
  
    for (const step of interaction.steps) {
      if (step.type === 'model_output') {
        for (const contentBlock of step.content || []) {
          if (contentBlock.type === 'text') {
            console.log(contentBlock.text);
            if (contentBlock.annotations) {
              console.log("\nSources:");
              for (const annotation of contentBlock.annotations) {
                if (annotation.type === 'place_citation') {
                  console.log(` - ${annotation.name}: ${annotation.url}`);
                }
              }
            }
          }
        }
      }
    }
  }
  
  await main();
  ```

  {% /tab %}

  {% tab label="Java" %}
  ```java
  import com.google.genai.Client;
  import com.google.genai.gaos.models.interactions.Annotation;
  import com.google.genai.gaos.models.interactions.Content;
  import com.google.genai.gaos.models.interactions.CreateModelInteraction;
  import com.google.genai.gaos.models.interactions.GoogleMaps;
  import com.google.genai.gaos.models.interactions.Interaction;
  import com.google.genai.gaos.models.interactions.InteractionsInput;
  import com.google.genai.gaos.models.interactions.Model;
  import com.google.genai.gaos.models.interactions.ModelOutputStep;
  import com.google.genai.gaos.models.interactions.PlaceCitation;
  import com.google.genai.gaos.models.interactions.Step;
  import com.google.genai.gaos.models.interactions.TextContent;
  import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
  import java.util.Arrays;
  
  Client client = new Client();
  
  CreateModelInteraction params =
      CreateModelInteraction.builder()
          .model(Model.of("gemini-3.8-flash"))
          .input(
              InteractionsInput.of(
                  "Is there a cafe near the corner of 1st and Main that has outdoor seating?"))
          .tools(
              Arrays.asList(
                  GoogleMaps.builder().latitude(34.050481).longitude(-118.248526).build()))
          .build();
  
  Interaction interaction =
      client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();
  
  if (interaction.steps().isPresent()) {
    for (Step step : interaction.steps().get()) {
      if (step instanceof ModelOutputStep) {
        ModelOutputStep outputStep = (ModelOutputStep) step;
        if (outputStep.content().isPresent()) {
          for (Content contentBlock : outputStep.content().get()) {
            if (contentBlock instanceof TextContent) {
              TextContent textContent = (TextContent) contentBlock;
              System.out.println(textContent.text().orElse(""));
              if (textContent.annotations().isPresent()
                  && !textContent.annotations().get().isEmpty()) {
                System.out.println("\nSources:");
                for (Annotation annotation : textContent.annotations().get()) {
                  if (annotation instanceof PlaceCitation) {
                    PlaceCitation citation = (PlaceCitation) annotation;
                    System.out.printf(
                        "  - %s: %s%n", citation.name().orElse(""), citation.url().orElse(""));
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  ```

  {% /tab %}

  {% tab label="Go" %}
  ```go
  package main
  
  import (
      "context"
      "fmt"
      "log"
  
      "google.golang.org/genai"
      "google.golang.org/genai/interactions/models/interactions"
      "google.golang.org/genai/interactions/models/operations"
  )
  
  func main() {
      ctx := context.Background()
      client, err := genai.NewClient(ctx, nil)
      if err != nil {
          log.Fatal(err)
      }
  
      resp, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{
          Body: operations.NewCreateInteractionRequestBody(
              interactions.CreateModelInteraction{
                  Model: interactions.Model("gemini-3.8-flash"),
                  Input: interactions.NewInteractionsInput("Is there a cafe near the corner of 1st and Main that has outdoor seating?"),
                  Tools: []interactions.Tool{
                      interactions.NewTool(interactions.GoogleMaps{
                          Latitude:  genai.Ptr(34.050481),
                          Longitude: genai.Ptr(-118.248526),
                      }),
                  },
              },
          ),
      })
      if err != nil {
          log.Fatal(err)
      }
  
      for _, step := range resp.Interaction.Steps {
          if step.ModelOutputStep != nil {
              for _, content := range step.ModelOutputStep.Content {
                  if content.TextContent != nil {
                      fmt.Println(content.TextContent.Text)
                      if len(content.TextContent.Annotations) > 0 {
                          fmt.Println("\nSources:")
                          for _, annotation := range content.TextContent.Annotations {
                              if annotation.PlaceCitation != nil {
                                  c := annotation.PlaceCitation
                                  name := ""
                                  if c.Name != nil {
                                      name = *c.Name
                                  }
                                  url := ""
                                  if c.URL != nil {
                                      url = *c.URL
                                  }
                                  fmt.Printf("  - %s: %s\n", name, url)
                              }
                          }
                      }
                  }
              }
          }
      }
  }
  ```

  {% /tab %}

{% /tabs %}

### Providing location-based personalization  {% id="location-personalization" %}

Get recommendations tailored to a user's preferences and a specific geographical
area.

{% tabs %}
  {% tab label="Python" %}
  ```python
  # This will only work for SDK newer than 2.0.0
  from google import genai
  
  client = genai.Client()
  
  interaction = client.interactions.create(
      model="gemini-3.8-flash",
      input="Which family-friendly restaurants near here have the best playground reviews?",
      tools=[{
          "type": "google_maps",
          "latitude": 30.2672,
          "longitude": -97.7431
      }]
  )
  
  for step in interaction.steps:
      if step.type == "model_output":
          for content_block in step.content:
              if content_block.type == "text":
                  print(content_block.text)
                  if content_block.annotations:
                      print("\nSources:")
                      for annotation in content_block.annotations:
                          if annotation.type == "place_citation":
                              print(f" - {annotation.name}: {annotation.url}")
  ```

  {% /tab %}

  {% tab label="JavaScript" %}
  ```javascript
  // This will only work for SDK newer than 2.0.0
  import { GoogleGenAI } from "@google/genai";
  
  const ai = new GoogleGenAI({});
  
  async function main() {
    const interaction = await ai.interactions.create({
      model: "gemini-3.8-flash",
      input: "Which family-friendly restaurants near here have the best playground reviews?",
      tools: [{
        type: "google_maps",
        latitude: 30.2672,
        longitude: -97.7431
      }]
    });
  
    for (const step of interaction.steps) {
      if (step.type === 'model_output') {
        for (const contentBlock of step.content || []) {
          if (contentBlock.type === 'text') {
            console.log(contentBlock.text);
            if (contentBlock.annotations) {
              console.log("\nSources:");
              for (const annotation of contentBlock.annotations) {
                if (annotation.type === 'place_citation') {
                  console.log(` - ${annotation.name}: ${annotation.url}`);
                }
              }
            }
          }
        }
      }
    }
  }
  
  await main();
  ```

  {% /tab %}

  {% tab label="Java" %}
  ```java
  import com.google.genai.Client;
  import com.google.genai.gaos.models.interactions.Annotation;
  import com.google.genai.gaos.models.interactions.Content;
  import com.google.genai.gaos.models.interactions.CreateModelInteraction;
  import com.google.genai.gaos.models.interactions.GoogleMaps;
  import com.google.genai.gaos.models.interactions.Interaction;
  import com.google.genai.gaos.models.interactions.InteractionsInput;
  import com.google.genai.gaos.models.interactions.Model;
  import com.google.genai.gaos.models.interactions.ModelOutputStep;
  import com.google.genai.gaos.models.interactions.PlaceCitation;
  import com.google.genai.gaos.models.interactions.Step;
  import com.google.genai.gaos.models.interactions.TextContent;
  import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
  import java.util.Arrays;
  
  Client client = new Client();
  
  CreateModelInteraction params =
      CreateModelInteraction.builder()
          .model(Model.of("gemini-3.8-flash"))
          .input(
              InteractionsInput.of(
                  "Which family-friendly restaurants near here have the best playground reviews?"))
          .tools(
              Arrays.asList(GoogleMaps.builder().latitude(30.2672).longitude(-97.7431).build()))
          .build();
  
  Interaction interaction =
      client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();
  
  if (interaction.steps().isPresent()) {
    for (Step step : interaction.steps().get()) {
      if (step instanceof ModelOutputStep) {
        ModelOutputStep outputStep = (ModelOutputStep) step;
        if (outputStep.content().isPresent()) {
          for (Content contentBlock : outputStep.content().get()) {
            if (contentBlock instanceof TextContent) {
              TextContent textContent = (TextContent) contentBlock;
              System.out.println(textContent.text().orElse(""));
              if (textContent.annotations().isPresent()
                  && !textContent.annotations().get().isEmpty()) {
                System.out.println("\nSources:");
                for (Annotation annotation : textContent.annotations().get()) {
                  if (annotation instanceof PlaceCitation) {
                    PlaceCitation citation = (PlaceCitation) annotation;
                    System.out.printf(
                        "  - %s: %s%n", citation.name().orElse(""), citation.url().orElse(""));
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  ```

  {% /tab %}

  {% tab label="Go" %}
  ```go
  package main
  
  import (
      "context"
      "fmt"
      "log"
  
      "google.golang.org/genai"
      "google.golang.org/genai/interactions/models/interactions"
      "google.golang.org/genai/interactions/models/operations"
  )
  
  func main() {
      ctx := context.Background()
      client, err := genai.NewClient(ctx, nil)
      if err != nil {
          log.Fatal(err)
      }
  
      resp, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{
          Body: operations.NewCreateInteractionRequestBody(
              interactions.CreateModelInteraction{
                  Model: interactions.Model("gemini-3.8-flash"),
                  Input: interactions.NewInteractionsInput("Which family-friendly restaurants near here have the best playground reviews?"),
                  Tools: []interactions.Tool{
                      interactions.NewTool(interactions.GoogleMaps{
                          Latitude:  genai.Ptr(30.2672),
                          Longitude: genai.Ptr(-97.7431),
                      }),
                  },
              },
          ),
      })
      if err != nil {
          log.Fatal(err)
      }
  
      for _, step := range resp.Interaction.Steps {
          if step.ModelOutputStep != nil {
              for _, content := range step.ModelOutputStep.Content {
                  if content.TextContent != nil {
                      fmt.Println(content.TextContent.Text)
                      if len(content.TextContent.Annotations) > 0 {
                          fmt.Println("\nSources:")
                          for _, annotation := range content.TextContent.Annotations {
                              if annotation.PlaceCitation != nil {
                                  c := annotation.PlaceCitation
                                  name := ""
                                  if c.Name != nil {
                                      name = *c.Name
                                  }
                                  url := ""
                                  if c.URL != nil {
                                      url = *c.URL
                                  }
                                  fmt.Printf("  - %s: %s\n", name, url)
                              }
                          }
                      }
                  }
              }
          }
      }
  }
  ```

  {% /tab %}

{% /tabs %}

### Assisting with itinerary planning  {% id="itinerary-planning" %}

Generate multi-day plans with directions and information about various
locations, perfect for travel applications.

{% tabs %}
  {% tab label="Python" %}
  ```python
  # This will only work for SDK newer than 2.0.0
  from google import genai
  
  client = genai.Client()
  
  prompt = "Plan a day in San Francisco for me. I want to see the Golden Gate Bridge, visit a museum, and have a nice dinner."
  
  interaction = client.interactions.create(
      model="gemini-3.8-flash",
      input=prompt,
      tools=[{
          "type": "google_maps",
          "latitude": 37.78193,
          "longitude": -122.40476
      }]
  )
  # ... code to process response
  ```

  {% /tab %}

  {% tab label="JavaScript" %}
  ```javascript
  // This will only work for SDK newer than 2.0.0
  import { GoogleGenAI } from "@google/genai";
  
  const ai = new GoogleGenAI({});
  
  async function main() {
    const interaction = await ai.interactions.create({
      model: "gemini-3.8-flash",
      input: "Plan a day in San Francisco for me. I want to see the Golden Gate Bridge, visit a museum, and have a nice dinner.",
      tools: [{
        type: "google_maps",
        latitude: 37.78193,
        longitude: -122.40476
      }]
    });
  }
  
  await main();
  ```

  {% /tab %}

  {% tab label="Java" %}
  ```java
  import com.google.genai.Client;
  import com.google.genai.gaos.models.interactions.CreateModelInteraction;
  import com.google.genai.gaos.models.interactions.GoogleMaps;
  import com.google.genai.gaos.models.interactions.Interaction;
  import com.google.genai.gaos.models.interactions.InteractionsInput;
  import com.google.genai.gaos.models.interactions.Model;
  import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
  import java.util.Arrays;
  
  Client client = new Client();
  
  String prompt =
      "Plan a day in San Francisco for me. I want to see the Golden Gate Bridge, visit a museum, and have a nice dinner.";
  
  CreateModelInteraction params =
      CreateModelInteraction.builder()
          .model(Model.of("gemini-3.8-flash"))
          .input(InteractionsInput.of(prompt))
          .tools(
              Arrays.asList(GoogleMaps.builder().latitude(37.78193).longitude(-122.40476).build()))
          .build();
  
  Interaction interaction =
      client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();
  
  // ... code to process response
  System.out.println(interaction.outputText().orElse(""));
  ```

  {% /tab %}

  {% tab label="Go" %}
  ```go
  package main
  
  import (
      "context"
      "fmt"
      "log"
  
      "google.golang.org/genai"
      "google.golang.org/genai/interactions/models/interactions"
      "google.golang.org/genai/interactions/models/operations"
  )
  
  func main() {
      ctx := context.Background()
      client, err := genai.NewClient(ctx, nil)
      if err != nil {
          log.Fatal(err)
      }
  
      prompt := "Plan a day in San Francisco for me. I want to see the Golden Gate Bridge, visit a museum, and have a nice dinner."
  
      resp, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{
          Body: operations.NewCreateInteractionRequestBody(
              interactions.CreateModelInteraction{
                  Model: interactions.Model("gemini-3.8-flash"),
                  Input: interactions.NewInteractionsInput(prompt),
                  Tools: []interactions.Tool{
                      interactions.NewTool(interactions.GoogleMaps{
                          Latitude:  genai.Ptr(37.78193),
                          Longitude: genai.Ptr(-122.40476),
                      }),
                  },
              },
          ),
      })
      if err != nil {
          log.Fatal(err)
      }
  
      // ... code to process response
      fmt.Println(resp.Interaction.GetOutputText())
  }
  ```

  {% /tab %}

  {% tab label="REST" %}
  ```shell
  # Specifies the API revision to avoid breaking changes when they become default
  curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
    -H "x-goog-api-key: $GEMINI_API_KEY" \
    -H 'Content-Type: application/json' \
    -H "Api-Revision: 2026-05-20" \
    -d '{
      "model": "gemini-3.8-flash",
      "input": "Plan a day in San Francisco for me. I want to see the Golden Gate Bridge, visit a museum, and have a nice dinner.",
      "tools": [{
        "type": "google_maps",
        "latitude": 37.78193,
        "longitude": -122.40476
      }]
    }'
  ```

  {% /tab %}

{% /tabs %}

## Service usage requirements  {% id="service-usage-requirements" %}

This section describes the service usage requirements for Grounding with Google
Maps.

### Inform the user about the use of Google Maps sources  {% id="inform-sources" %}

With each Google Maps Grounded result, you'll receive source annotations on
the `model_output` step's content blocks that support each response. The
following metadata is returned:

* source url
* name

When presenting results from Grounding with Google Maps, you must specify the
associated Google Maps sources, and inform your users of the following:

*   The Google Maps sources must immediately follow the generated content that
  the sources support. This generated content is also referred to as Google
  Maps Grounded Result.

*   The Google Maps sources must be viewable within one user interaction.


### Display Google Maps sources with Google Maps links  {% id="display-sources" %}

For each source annotation, a link preview must
be generated following these requirements:

*   Attribute each source to Google Maps following the Google Maps text
  [attribution guidelines](/docs/maps-grounding#maps-attribution-guidelines).

*   Display the source name provided in the response.

*   Link to the source using the `url` from the annotation.


### Google Maps text attribution guidelines  {% id="maps-attribution-guidelines" %}

When you attribute sources to Google Maps in text, follow these guidelines:

* Don't modify the text Google Maps in any way:  *   Don't change the capitalization of Google Maps.
  *   Don't wrap Google Maps onto multiple lines.
  *   Don't localize Google Maps into another language.
  *   Prevent browsers from translating Google Maps by using the HTML
    attribute translate="no".


For more information about some of our Google Maps data providers and their
license terms, see the [Google Maps and Google Earth legal notices](https://www.google.com/help/legalnotices_maps/).

## Best practices  {% id="best-practices" %}

*   **Provide user location:** For the most relevant and personalized responses,
  always include the `latitude` and `longitude` in your `google_maps` tool
  configuration when the user's location is known.

*   **Inform End-Users:** Clearly inform your end-users that Google Maps
  data is being used to answer their queries, especially when the tool is
  enabled.

*   **Toggle Off When Not Needed:** Grounding with Google Maps is off by
  default. Only enable it (`"tools": [{"type": "google_maps"}]`) when a query
  has a clear geographical context, to optimize performance and cost.


## Limitations  {% id="limitations" %}

*   Grounding with Google Maps currently only supports English language prompts
  and responses.

*   The tool may not be available in all regions.

*   Results may vary based on location accuracy and available Maps data.

*   **Geographical Scope:** Grounding with Google Maps is globally available.

*   **Default State:** The Grounding with Google Maps tool is off by default.
  You must explicitly enable it in your API requests.


## Pricing and rate limits  {% id="pricing-and-rate-limits" %}

Grounding with Google Maps pricing differs depending on the model generation:

*   **Gemini 3 and newer models:** Your project is billed for each search query
  that the model decides to execute, with 5,000 free requests per month shared
  across all Gemini 3 and newer models, and then **$14 per 1,000 search
  queries**. A single search prompt (your API request to the model) might
  result in the model executing multiple search queries to find the necessary
  information. Each of these queries counts as a billable use of the tool.
*   **Gemini 2.5 and older models:** Your project is billed per search prompt
  ($25 per 1,000 grounded prompts). A request is only billed if the prompt
  successfully returns at least one Google Maps grounded result, regardless of
  how many individual search queries the model performed internally to get
  that result.

The quota for Grounding with Google Maps typically aligns with the underlying
Gemini model rate limits. For detailed pricing information, see the [Gemini API
pricing page](/docs/pricing).

## Supported models  {% id="supported-models" %}

The following models support Grounding with Google Maps:

| Model | Grounding with Google Maps |
| --- | :---: |
| [Gemini 4 Carbon](/docs/models/gemini-4-carbon) | ✔️ |
| [Gemini 4 Argon](/docs/models/gemini-4-argon) | ✔️ |
| [Gemini 3.8 Flash](/docs/models/gemini-3.8-flash) | ✔️ |
| [Gemini 3.6 Flash](/docs/models/gemini-3.6-flash) | ✔️ |
| [Gemini 3.5 Flash-Lite](/docs/models/gemini-3.5-flash-lite) | ✔️ |
| [Gemini 3.1 Pro Preview](/docs/models/gemini-3.1-pro-preview) | ✔️ |
| [Gemini 3.1 Flash-Lite](/docs/models/gemini-3.1-flash-lite) | ✔️ |
| [Gemini 3 Flash Preview](/docs/models/gemini-3-flash-preview) | ✔️ |
| [Gemini 2.5 Pro](/docs/models/gemini-2.5-pro) | ✔️ |
| [Gemini 2.5 Flash](/docs/models/gemini-2.5-flash) | ✔️ |
| [Gemini 2.5 Flash-Lite](/docs/models/gemini-2.5-flash-lite) | ✔️ |

## Supported tool combinations  {% id="tool-combination" %}

You can use Grounding with Google Maps with other built-in tools like
[Grounding with Google Search](/docs/google-search) (supported on Gemini 3.5
Flash and later models) to power more complex use cases. Gemini 4 and Gemini 3 models also
support combining these built-in tools with custom tools (function calling).
Learn more on the [tool combinations](/docs/tool-combination) page.

## What's next  {% id="whats-next" %}

* Learn about other [available tools](/docs/tools).
* To learn more about responsible AI best practices and Gemini API's safety
  filters, see [the Safety settings guide](/docs/safety-settings).

