Google マップによるグラウンディングは、Gemini の生成機能と Google マップの豊富で事実に基づいた最新のデータを接続します。この機能により、デベロッパーは位置情報を認識する機能をアプリに簡単に組み込むことができます。ユーザーのクエリに Google マップのデータに関連するコンテキストが含まれている場合、Gemini モデルは Google マップを活用して、ユーザーが指定した場所やおおよその現在地に関連する、事実に基づいた最新の回答を提供します。
- 正確で位置情報を認識した回答: Google マップの広範で最新のデータを活用して、地理的に特定のクエリに対応します。
- パーソナライズの強化: ユーザーが提供した位置情報に基づいて、おすすめ情報や情報をカスタマイズします。
- コンテキスト情報とウィジェット: 生成されたコンテンツとともにインタラクティブな Google マップ ウィジェットをレンダリングするためのコンテキスト トークン。
始める
この例では、Google マップによるグラウンディングをアプリケーションに統合して、ユーザーのクエリに対して正確な位置情報認識応答を提供する方法を示します。プロンプトは、ユーザーの現在地(省略可)に基づいてローカルのおすすめを尋ねるもので、Gemini モデルが Google マップのデータを使用できるようになっています。
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.5-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}")
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.5-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}`);
}
}
}
}
}
}
}
}
main();
REST
# 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.5-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
}]
}'
Google マップによるグラウンディングの仕組み
Google マップによるグラウンディングは、Maps API をグラウンディング ソースとして使用して、Gemini API を Google Geo エコシステムと統合します。ユーザーのクエリに地理的コンテキストが含まれている場合、Gemini モデルは Google マップによるグラウンディング ツールを呼び出すことができます。その後、モデルは、指定された場所に関連する Google マップのデータに基づいて回答を生成できます。
このプロセスには通常、次の手順が含まれます。
- ユーザー クエリ: ユーザーがアプリケーションにクエリを送信します。このクエリには、地理的なコンテキスト(「近くのカフェ」、「サンフランシスコの博物館」など)が含まれる可能性があります。
- ツール呼び出し: Gemini モデルは、地理的な意図を認識して、Google マップによるグラウンディング ツールを呼び出します。このツールには、ユーザーの
latitudeとlongitudeをオプションで指定できます。このツールはテキスト検索ツールで、ローカル クエリ(「近くの」)では座標が使用され、特定のクエリやローカル以外のクエリでは明示的な位置情報の影響を受けにくいという点で、マップでの検索と同様の動作をします。 - データ取得: Google マップによるグラウンディング サービスは、関連情報(場所、レビュー、写真、住所、営業時間など)について Google マップにクエリを送信します。
- グラウンディングされた生成: 取得されたマップデータは、Gemini モデルの回答に反映され、事実の正確性と関連性が確保されます。
- 回答とアノテーション: モデルは、Google マップのソースにリンクするインライン アノテーションを含むテキスト レスポンスを返します。これにより、デベロッパーは引用を表示し、必要に応じてコンテキストに応じた Google マップ ウィジェットをレンダリングできます。
Google マップによるグラウンディングを使用する理由とタイミング
Google マップによるグラウンディングは、正確で最新の、位置情報に固有の情報を必要とするアプリケーションに最適です。世界中の 2 億 5,000 万を超える場所に関する Google マップの広範なデータベースに裏打ちされた、関連性の高いパーソナライズされたコンテンツを提供することで、ユーザー エクスペリエンスを向上させます。
アプリケーションで次のことが必要な場合は、Google マップによるグラウンディングを使用する必要があります。
- 地域固有の質問に対して完全かつ正確に回答します。
- 会話型の旅行プランナーやローカルガイドを構築する。
- レストランやショップなどの場所とユーザーの好みに基づいて、おすすめのスポットを提案します。
- ソーシャル サービス、小売サービス、フード デリバリー サービス向けに位置情報認識エクスペリエンスを作成します。
Google マップによるグラウンディングは、「近くの最高のコーヒー ショップ」を探したり、道順を取得したりするなど、近接性と現在の事実データが重要なユースケースで優れています。
ユースケース
Google マップによるグラウンディングは、さまざまな位置情報認識ユースケースをサポートしています。
場所に関する質問への対応
特定の場所について詳細な質問をすると、Google ユーザーのクチコミやその他のマップデータに基づいて回答が得られます。
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.5-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}")
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.5-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}`);
}
}
}
}
}
}
}
}
main();
位置情報に基づくカスタマイズの提供
ユーザーの好みや特定の地域に合わせたおすすめ情報を取得します。
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.5-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}")
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.5-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}`);
}
}
}
}
}
}
}
}
main();
旅程の計画を支援する
旅行アプリに最適な、さまざまな場所の経路と情報を含む複数日間のプランを生成します。
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.5-flash",
input=prompt,
tools=[{
"type": "google_maps",
"latitude": 37.78193,
"longitude": -122.40476,
"enable_widget": True
}]
)
# ... code to process response and widget token
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.5-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,
enable_widget: true
}]
});
}
main();
REST
# 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.5-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,
"enable_widget": true
}]
}'
サービスの使用要件
このセクションでは、Google マップによるグラウンディングのサービス使用要件について説明します。
Google マップのソースの使用についてユーザーに通知する
Google マップのグラウンディングされた結果ごとに、各レスポンスをサポートするソース アノテーションが model_output ステップのコンテンツ ブロックに提供されます。次のメタデータが返されます。
- ソース URL
- name
「Google マップによるグラウンディング」の結果を表示する場合は、関連する Google マップのソースを指定し、ユーザーに次の情報を通知する必要があります。
- Google マップのソースは、ソースがサポートする生成コンテンツの直後に示す必要があります。この生成されたコンテンツは、Google マップによるグラウンディングの結果ともいいます。
- Google マップのソースは、1 回のユーザー操作で表示できる必要があります。
Google マップへのリンクを含む Google マップのソースを表示する
各ソース アノテーションについて、次の要件に沿ってリンクのプレビューを生成する必要があります。
- Google マップのテキストでの帰属表示に関するガイドラインに沿って、各ソースを Google マップに帰属させます。
- レスポンスで提供されたソース名を表示します。
- アノテーションの
urlを使用してソースにリンクします。
Google マップのテキストでの帰属表示に関するガイドライン
テキストでソースを Google マップに帰属させる場合は、次のガイドラインに従ってください。
- 「Google Maps」というテキストは一切変更しないでください。
- Google マップの文字の大小は変更しないでください。
- Google マップを複数行に折り返さないでください。
- Google マップを他の言語にローカライズしないでください。
- HTML 属性 translate="no" を使用して、ブラウザが Google マップを翻訳しないようにします。
Google マップのデータ プロバイダとそのライセンス条項について詳しくは、Google マップと Google Earth の法的通知をご覧ください。
ベスト プラクティス
- ユーザーの位置情報を指定する: 最も関連性の高いパーソナライズされた回答を得るには、ユーザーの位置情報がわかっている場合は、
google_mapsツールの構成で常にlatitudeとlongitudeを含めます。 - Google マップ コンテキスト ウィジェットをレンダリングする: コンテキスト ウィジェットは、Gemini API レスポンスで返されるコンテキスト トークン
google_maps_widget_context_tokenを使用してレンダリングされます。このトークンは、Google マップのビジュアル コンテンツのレンダリングに使用できます。 - エンドユーザーに通知する: Google マップのデータがクエリの回答に使用されていることをエンドユーザーに明確に通知します。特に、ツールが有効になっている場合は、この点に注意してください。
- 不要な場合はオフに切り替え: Google マップによるグラウンディングはデフォルトでオフになっています。パフォーマンスと費用を最適化するため、クエリに明確な地理的コンテキストがある場合にのみ有効(
"tools": [{"type": "google_maps"}])にします。
制限事項
- Google マップによるグラウンディングは、現在、英語のプロンプトとレスポンスのみをサポートしています。
- このツールは、一部の地域ではご利用いただけない場合があります。
- 結果は、位置情報の精度と利用可能な Google マップのデータによって異なる場合があります。
- 地理的範囲: Google マップによるグラウンディングはグローバルで利用できます。
- デフォルトの状態: Google マップによるグラウンディング ツールはデフォルトでオフになっています。API リクエストで明示的に有効にする必要があります。
料金とレート制限
Google マップによるグラウンディングの料金はクエリに基づいています。現在のレートは $25 / 1,000 個のグラウンディングされたプロンプトです。無料枠では、1 日あたり最大 500 件のリクエストも利用できます。リクエストが割り当てにカウントされるのは、プロンプトが Google マップのグラウンディングされた結果(つまり、Google マップのソースを少なくとも 1 つ含む結果)を少なくとも 1 つ正常に返した場合のみです。1 つのリクエストから Google マップに複数のクエリが送信された場合、レート制限に対して 1 つのリクエストとしてカウントされます。
料金の詳細については、Gemini API の料金ページをご覧ください。
サポートされているモデル
次のモデルは、Google マップによるグラウンディングをサポートしています。
| モデル | Google マップによるグラウンディング |
|---|---|
| Gemini 3.5 Flash | ✔️ |
| Gemini 3.1 Pro プレビュー版 | ✔️ |
| Gemini 3.1 Flash-Lite | ✔️ |
| Gemini 3.1 Flash-Lite プレビュー | ✔️ |
| Gemini 3 Flash プレビュー | ✔️ |
| Gemini 2.5 Pro | ✔️ |
| Gemini 2.5 Flash | ✔️ |
| Gemini 2.5 Flash-Lite | ✔️ |
| Gemini 2.0 Flash | ✔️ |
サポートされているツールの組み合わせ
Gemini 3 モデルは、組み込みツール(Google マップによるグラウンディングなど)とカスタムツール(関数呼び出し)の組み合わせをサポートしています。詳しくは、ツールの組み合わせのページをご覧ください。