SuperAPI AI Directory

amap-traffic

Coding & development

View repository

Updated 10-15 19:51

About this skill

Amap Real-Time Traffic and Route Planning

Overview

This skill is implemented through the Amap API:

  1. Real-time traffic query: Get the congestion status of a specified road/area
  2. Intelligent route planning: Calculate the fastest driving route based on real-time traffic
  3. Multi-plan comparison: Provide route comparisons across dimensions such as time, distance, and cost

🔑 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 re-reads the latest openclaw.json from AMAP_KEYon every call, supporting immediate effect after the key is dynamically updated on the frontend.

API Usage Instructions

1. Real-time traffic query

curl "https://restapi.amap.com/v3/traffic/status/road?roadid={道路ID}&key={动态读取的AMAP_KEY}"

2. Intelligent route planning (including real-time traffic)

curl "https://restapi.amap.com/v3/direction/driving?origin={起点坐标}&destination={终点坐标}&strategy=2&key={动态读取的AMAP_KEY}"
  • strategy=2: Fastest route with priority given to real-time traffic

Traffic status description

  • Clear: 🟢 Green (speed > 40km/h)
  • Slow: 🟡 Yellow (20-40km/h)
  • Congested: 🔴 Red (< 20km/h)
  • Severely congested: 🟣 Purple-red (< 10km/h)

Resources

scripts/

Contains the 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 on every execution, ensuring immediate effect after the key is dynamically updated on the frontend.