amap-traffic

Original🇨🇳 Chinese
Translated
1 scriptsChecked / no sensitive code detected

Skill for real-time traffic query and optimal self-driving route planning based on Amap. It provides real-time congestion information and fastest route recommendations by leveraging Amap Traffic Situation API and Route Planning API.

1installs
Added on

NPX Install

npx skill4agent add agentbay-ai/agentbay-skills amap-traffic

Tags

Translated version includes tags in frontmatter

SKILL.md Content (Chinese)

View Translation Comparison →

Amap Real-time Traffic and Route Planning

Overview

This skill is implemented via Amap APIs, including:
  1. Real-time Traffic Query: Obtain congestion status of specified roads/areas
  2. Intelligent Route Planning: Calculate the fastest self-driving route based on real-time traffic
  3. Multi-scheme Comparison: Provide route comparisons in dimensions such as time, distance, cost, etc.

🔑 API Key Configuration

  1. Visit Amap Open Platform to create a Key
  2. Set it on the OpenClaw Web configuration page:
    Address: http://127.0.0.1:18789/skills
    Configuration file field:
    skills.entries.amap-traffic.AMAP_KEY
    in
    openclaw.json

    Value: Your Amap API Key
Note: This skill reads the latest
AMAP_KEY
from
openclaw.json
every time it is called, supporting immediate effect after dynamic key update on the frontend.

API Usage Instructions

1. Real-time Traffic Query

bash
curl "https://restapi.amap.com/v3/traffic/status/road?roadid={Road ID}&key={Dynamically read AMAP_KEY}"

2. Intelligent Route Planning (with real-time traffic)

bash
curl "https://restapi.amap.com/v3/direction/driving?origin={Starting coordinates}&destination={Destination coordinates}&strategy=2&key={Dynamically read AMAP_KEY}"
  • strategy=2
    : Prioritize the fastest route considering real-time traffic

Traffic Status Explanation

  • Smooth: 🟢 Green (Speed > 40km/h)
  • Slow-moving: 🟡 Yellow (20-40km/h)
  • Congested: 🔴 Red (< 20km/h)
  • Severely Congested: 🟣 Magenta (< 10km/h)

Resources

scripts/

Contains core scripts for Amap real-time traffic query and route planning.

scripts/amap_traffic.py

Python script that implements complete real-time traffic query and optimal route planning functions. It reads the latest AMAP_KEY from
/home/admin/.openclaw/openclaw.json
every time it executes
, ensuring immediate effect after dynamic key update on the frontend.