← 返回
开发者工具 Key 中文

Google Maps

Google Maps integration for OpenClaw with Routes API. Use for: (1) Distance/travel time calculations with traffic prediction, (2) Turn-by-turn directions, (3...
Google Maps 与 OpenClaw 的集成,使用 Routes API。用于:(1) 带交通预测的距离/行程时间计算;(2) 逐向导航;(3...
shaharsha
开发者工具 clawhub v3.2.0 2 版本 100000 Key: 需要
★ 9
Stars
📥 4,982
下载
💾 296
安装
2
版本
#directions#distance#google#latest#location#maps#navigation#places#search

概述

Google Maps 🗺️

Google Maps integration powered by the Routes API.

Requirements

  • GOOGLE_API_KEY environment variable
  • Enable in Google Cloud Console: Routes API, Places API, Geocoding API
  • Python package: requests (pip install requests)

Configuration

Env VariableDefaultDescription
------------------------------------
GOOGLE_API_KEY-Required. Your Google Maps API key
GOOGLE_MAPS_API_KEY-Alternative to GOOGLE_API_KEY (fallback)
GOOGLE_MAPS_LANGenResponse language (en, he, ja, etc.)

Set in OpenClaw config:

{
  "env": {
    "GOOGLE_API_KEY": "AIza...",
    "GOOGLE_MAPS_LANG": "en"
  }
}

Script Location

python3 skills/google-maps/lib/map_helper.py <action> [options]

Actions

distance - Calculate travel time

python3 skills/google-maps/lib/map_helper.py distance "origin" "destination" [options]

Options:

OptionValuesDescription
-----------------------------
--modedriving, walking, bicycling, transitTravel mode (default: driving)
--departnow, +30m, +1h, 14:00, 2026-02-07 08:00Departure time
--arrive14:00Arrival time (transit only)
--trafficbest_guess, pessimistic, optimisticTraffic model
--avoidtolls, highways, ferriesComma-separated

Examples:

python3 skills/google-maps/lib/map_helper.py distance "New York" "Boston"
python3 skills/google-maps/lib/map_helper.py distance "Los Angeles" "San Francisco" --depart="+1h"
python3 skills/google-maps/lib/map_helper.py distance "Chicago" "Detroit" --depart="08:00" --traffic=pessimistic
python3 skills/google-maps/lib/map_helper.py distance "London" "Manchester" --mode=transit --arrive="09:00"
python3 skills/google-maps/lib/map_helper.py distance "Paris" "Lyon" --avoid=tolls,highways

Response:

{
  "distance": "215.2 mi",
  "distance_meters": 346300,
  "duration": "3 hrs 45 mins",
  "duration_seconds": 13500,
  "static_duration": "3 hrs 30 mins",
  "duration_in_traffic": "3 hrs 45 mins"
}

directions - Turn-by-turn route

python3 skills/google-maps/lib/map_helper.py directions "origin" "destination" [options]

Additional options (beyond distance):

OptionDescription
---------------------
--alternativesReturn multiple routes
--waypointsIntermediate stops (pipe-separated)
--optimizeOptimize waypoint order (TSP)

Examples:

python3 skills/google-maps/lib/map_helper.py directions "New York" "Washington DC"
python3 skills/google-maps/lib/map_helper.py directions "San Francisco" "Los Angeles" --alternatives
python3 skills/google-maps/lib/map_helper.py directions "Miami" "Orlando" --waypoints="Fort Lauderdale|West Palm Beach" --optimize

Response includes: summary, labels, duration, static_duration, warnings, steps[], optimized_waypoint_order


matrix - Distance matrix

Calculate distances between multiple origins and destinations:

python3 skills/google-maps/lib/map_helper.py matrix "orig1|orig2" "dest1|dest2"

Example:

python3 skills/google-maps/lib/map_helper.py matrix "New York|Boston" "Philadelphia|Washington DC"

Response:

{
  "origins": ["New York", "Boston"],
  "destinations": ["Philadelphia", "Washington DC"],
  "results": [
    {"origin_index": 0, "destination_index": 0, "distance": "97 mi", "duration": "1 hr 45 mins"},
    {"origin_index": 0, "destination_index": 1, "distance": "225 mi", "duration": "4 hrs 10 mins"}
  ]
}

geocode - Address to coordinates

python3 skills/google-maps/lib/map_helper.py geocode "1600 Amphitheatre Parkway, Mountain View, CA"
python3 skills/google-maps/lib/map_helper.py geocode "10 Downing Street, London"

reverse - Coordinates to address

python3 skills/google-maps/lib/map_helper.py reverse 40.7128 -74.0060  # New York City
python3 skills/google-maps/lib/map_helper.py reverse 51.5074 -0.1278  # London

search - Find places

python3 skills/google-maps/lib/map_helper.py search "coffee near Times Square"
python3 skills/google-maps/lib/map_helper.py search "pharmacy in San Francisco" --open

details - Place information

python3 skills/google-maps/lib/map_helper.py details "<place_id>"

Traffic Models

ModelUse Case
-----------------
best_guessDefault balanced estimate
pessimisticImportant meetings (worst-case)
optimisticBest-case scenario

Regional Notes

Some features may not be available in all countries:

FeatureAvailability
-----------------------
--fuel-efficientUS, EU, select countries
--shorterLimited availability
--mode=two_wheelerAsia, select countries

Check Google Maps coverage for details.


Multilingual Support

Works with addresses in any language:

# Hebrew
python3 skills/google-maps/lib/map_helper.py distance "תל אביב" "ירושלים"
python3 skills/google-maps/lib/map_helper.py geocode "דיזנגוף 50, תל אביב"

# Japanese
python3 skills/google-maps/lib/map_helper.py distance "東京" "大阪"

# Arabic
python3 skills/google-maps/lib/map_helper.py distance "دبي" "أبو ظبي"

Language configuration:

  1. Set default via env: GOOGLE_MAPS_LANG=he (persists)
  2. Override per-request: --lang=ja
# Set Hebrew as default in OpenClaw config
GOOGLE_MAPS_LANG=he

# Override for specific request
python3 skills/google-maps/lib/map_helper.py distance "Tokyo" "Osaka" --lang=ja

Help

python3 skills/google-maps/lib/map_helper.py help

版本历史

共 2 个版本

  • v3.2.0 当前
    2026-03-28 10:05 安全 安全
  • v3.1.2
    2026-03-26 21:13

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 921 📥 185,796
developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 668 📥 324,150
developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 68 📥 180,164