GEMINI LABJP
CLI — Gemini CLI and the Gemini Code Assist IDE extensions stopped serving requests on Jun 18; migrate to Antigravity or the new Go-based Antigravity CLIFLASH — Gemini 3.5 Flash is now generally available, billed as the smartest model for sustained frontier performance on agentic and coding tasksIMAGE — gemini-3.1-flash-image-preview and gemini-3-pro-image-preview are deprecated and shut down on Jun 25; move to the successor modelsAGENTS — Managed Agents is in public preview, running stateful autonomous agents in secure, isolated Google-hosted Linux sandboxesSEARCH — File Search now supports multimodal image search natively via the gemini-embedding-2 modelMIGRATE — With deadline-bound deprecations piling up, any automation built on the CLI or old models needs a tracked migrationCLI — Gemini CLI and the Gemini Code Assist IDE extensions stopped serving requests on Jun 18; migrate to Antigravity or the new Go-based Antigravity CLIFLASH — Gemini 3.5 Flash is now generally available, billed as the smartest model for sustained frontier performance on agentic and coding tasksIMAGE — gemini-3.1-flash-image-preview and gemini-3-pro-image-preview are deprecated and shut down on Jun 25; move to the successor modelsAGENTS — Managed Agents is in public preview, running stateful autonomous agents in secure, isolated Google-hosted Linux sandboxesSEARCH — File Search now supports multimodal image search natively via the gemini-embedding-2 modelMIGRATE — With deadline-bound deprecations piling up, any automation built on the CLI or old models needs a tracked migration
Articles/API / SDK
API / SDK/2026-06-19Intermediate

Building location-aware AI with Gemini's Google Maps grounding: pricing and the source-display rules tutorials skip

How to ship a 'recommend something nearby' feature with Gemini API's Google Maps grounding, with the $25/1K cost design and the source-display obligations laid out for indie developers.

gemini84gemini-api241grounding3google-mapslocation

Premium Article

I once wanted to add a small feature to one of my calming apps: suggest a quiet café nearby where a user could step away for a moment. Most of the apps I run as an indie developer have never touched location data, so the first thing that hit me was a practical wall — how would I ever maintain a database of places worldwide? Calling a paid Places API and building my own ranking on top is too heavy to run alone.

Gemini API's Google Maps grounding is what lets you go around that wall. It hands the model a "sense of place" and backs answers with real Google Maps data (businesses, reviews, opening hours). As of June 2026 it works on several models, including Gemini 3.5 Flash. Getting it to respond takes only a few lines — but if you ship it without understanding the billing structure and the attribution rules, it bites back later. Here are the things I sorted out while wiring it up.

Grounding hands the model a "sense of place"

Under the hood, this tool is a text search. When a user's query carries geographical context ("near me," "in San Francisco"), the model queries Google Maps and generates an answer informed by the result. If you pass latitude and longitude, "near me" style queries are interpreted around those coordinates, while specific or non-local queries are barely influenced by them.

The flow goes like this: the user sends a query with geographical intent, the model invokes the tool, the Maps service pulls places and reviews, that real data shapes the answer, and a text response comes back with sources attached. If you think of it as the "retrieve → inject context → generate" of a hand-built RAG pipeline, but specialized for place data and handled on Google's side, it clicks into place.

One thing worth noting: the tool is off by default. It only runs on requests where you explicitly enable it. That is not an oversight — given the billing and latency below, it is a welcome default.

Minimal implementation — enable the tool and pass coordinates

Start plainly. Put Google Maps into tools, and optionally pass coordinates through toolConfig. Here it is in the official Python SDK (google-genai).

from google import genai
from google.genai import types
 
client = genai.Client()  # reads GEMINI_API_KEY from the environment
 
prompt = "Is there a quiet café within a 15-minute walk from here?"
 
response = client.models.generate_content(
    model="gemini-3.5-flash",
    contents=prompt,
    config=types.GenerateContentConfig(
        # Turn on Google Maps grounding
        tools=[types.Tool(google_maps=types.GoogleMaps())],
        # Optional: pass the user's location as context (this is near Tokyo Station)
        tool_config=types.ToolConfig(
            retrieval_config=types.RetrievalConfig(
                lat_lng=types.LatLng(latitude=35.681236, longitude=139.767125)
            )
        ),
    ),
)
 
print(response.text)

JavaScript (@google/genai) has the same shape: put googleMaps: {} in tools, and pass coordinates to toolConfig.retrievalConfig.latLng.

import { GoogleGenAI } from "@google/genai";
 
const ai = new GoogleGenAI({}); // GEMINI_API_KEY from the environment
 
const response = await ai.models.generateContent({
  model: "gemini-3.5-flash",
  contents: "Is there a quiet café within a 15-minute walk from here?",
  config: {
    tools: [{ googleMaps: {} }],
    toolConfig: {
      retrievalConfig: {
        latLng: { latitude: 35.681236, longitude: 139.767125 },
      },
    },
  },
});
 
console.log(response.text);

Ask for "cafés nearby" and you will get a plausible answer. But putting that on screen as-is violates the terms, because you must display the returned sources according to the rules.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
Get a minimal 'recommend something nearby' implementation running on Gemini 3.5 Flash, in both Python and JavaScript, without owning a place database
Understand why $25 / 1K separate-line billing makes 'always on' unsustainable, and switch to a design that enables the tool only when the query is geographical
Meet the groundingChunks source-display obligations (Google Maps attribution rules) and avoid the policy issues that can get your app cut off
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Gemini Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

API / SDK2026-06-17
Moving My Automation Off the Gemini CLI Before the June 18 Shutdown
On June 18, the Gemini CLI stops responding for hosted plans. Here is how I moved unattended scripts that called gemini from the shell over to the google-genai SDK, with structured output, retries, and cost measurement built in.
API / SDK2026-06-17
Keep Your Flash-to-Pro Routing Threshold Honest with Shadow Re-evaluation
A Flash-generates, Pro-on-low-confidence router starts drifting the moment you hand-pick its threshold. This is a working build of a loop that samples your kept-Flash outputs, scores them against Pro, and recalibrates the threshold from a quality budget.
API / SDK2026-06-16
Don't Break When the Default Model Moves: A Startup Capability-Probing Layer for Gemini
Pinning a model name breaks on deprecation; trusting the default breaks when the weights swap silently. This is the design I settled on: probe what the served model can actually do at startup, then build every request from that answer. Includes runnable Python.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →