home / skills / openclaw / skills / amap

amap skill

/skills/dboy233/amap

This skill enables weather, POI search, routing and geocoding using Amap Web Service API to offer location insights.

npx playbooks add skill openclaw/skills --skill amap

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
3.0 KB
---
name: amap
description: 使用高德地图Web服务API进行地点搜索、天气查询和路线规划。
homepage: https://lbs.amap.com/
metadata: {"clawdbot":{"emoji":"🗺️","requires":{"bins":["curl"]},"primaryEnv":"AMAP_KEY"}}
---

# 高德地图 (Amap)

本技能使用高德地图 Web 服务 API 提供丰富的地理位置服务。

**重要:** 使用本技能前,你必须在高德开放平台申请一个 Web 服务 API Key,并将其设置为环境变量 `AMAP_KEY`。

```bash
export AMAP_KEY="你的Web服务API Key"
```

Clawdbot 会自动读取这个环境变量来调用 API。

## 何时使用 (触发条件)

当用户提出以下类型的请求时,应优先使用本技能:
- "帮我查一下[城市]的天气"
- "搜索[地点]附近的[东西]"
- "查找[关键词]的位置"
- "从[A]到[B]怎么走?"
- "查询[地址]的经纬度"
- "这个坐标[经度,纬度]是哪里?"

## 核心功能与用法

### 1. 天气查询

用于查询指定城市的实时天气或天气预报。

**注意:** API 需要城市的 `adcode`。如果不知道 adcode,可以先通过 **行政区划查询** 功能获取。

#### 查询实时天气
```bash
# 将 [城市adcode] 替换为实际的行政区编码, 例如北京是 110000
curl "https://restapi.amap.com/v3/weather/weatherInfo?key=$AMAP_KEY&city=[城市adcode]&extensions=base"
```

#### 查询天气预报
```bash
# 将 [城市adcode] 替换为实际的行政区编码
curl "https://restapi.amap.com/v3/weather/weatherInfo?key=$AMAP_KEY&city=[城市adcode]&extensions=all"
```

### 2. 地点搜索 (POI)

用于根据关键字在指定城市搜索地点信息。

```bash
# 将 [关键词] 和 [城市] 替换为用户提供的内容
curl "https://restapi.amap.com/v3/place/text?key=$AMAP_KEY&keywords=[关键词]&city=[城市]"
```

### 3. 驾车路径规划

用于规划两个地点之间的驾车路线。

**注意:** API 需要起终点的经纬度坐标。如果用户提供的是地址,需要先通过 **地理编码** 功能将地址转换为坐标。

```bash
# 将 [起点经纬度] 和 [终点经纬度] 替换为实际坐标,格式为 "经度,纬度"
curl "https://restapi.amap.com/v3/direction/driving?key=$AMAP_KEY&origin=[起点经纬度]&destination=[终点经纬度]"
```

### 4. 地理编码 (地址 → 坐标)

将结构化的地址信息转换为经纬度坐标。

```bash
# 将 [地址] 替换为用户提供的地址
curl "https://restapi.amap.com/v3/geocode/geo?key=$AMAP_KEY&address=[地址]"
```

### 5. 逆地理编码 (坐标 → 地址)

将经纬度坐标转换为结构化的地址信息。

```bash
# 将 [经纬度] 替换为实际坐标,格式为 "经度,纬度"
curl "https://restapi.amap.com/v3/geocode/regeo?key=$AMAP_KEY&location=[经纬度]"
```

### 6. 行政区划查询 (获取 adcode)

用于查询省、市、区、街道的行政区划信息,包括 `adcode` 和边界。

```bash
# 将 [关键词] 替换为城市或区域名称,例如 "北京市"
curl "https://restapi.amap.com/v3/config/district?key=$AMAP_KEY&keywords=[关键词]&subdistrict=0"
```

Overview

This skill integrates with the Amap (Gaode) Web Service API to perform place search, weather lookup, routing, geocoding and reverse geocoding. It requires a valid Amap Web Service API key provided via the AMAP_KEY environment variable. The skill returns structured location data and can convert between addresses and coordinates to support route planning and POI discovery.

How this skill works

The skill calls Amap REST endpoints to fetch weather (real-time or forecast), search POIs by keyword and city, compute driving routes between coordinates, and translate addresses to/from latitude-longitude. If a user supplies an address, the skill geocodes it to coordinates; if the user supplies coordinates, it reverse-geocodes to a structured address. Administrative district queries return adcodes needed for weather queries and more precise searches.

When to use it

  • Check current weather or forecast for a city or administrative area.
  • Search for nearby points of interest or find addresses by keyword.
  • Convert an address to coordinates or find the address for given coordinates.
  • Plan a driving route between two locations when you have or can obtain coordinates.
  • Lookup administrative adcodes or district boundaries for precise queries.

Best practices

  • Set AMAP_KEY as an environment variable before using the skill (AMAP_KEY must be a valid Amap Web Service API key).
  • If you don’t know a city’s adcode, first run an administrative district query to get the adcode for weather or region-limited searches.
  • For routing, prefer supplying coordinates (longitude,latitude). If a user gives an address, geocode it first to avoid ambiguous routing results.
  • Limit keyword and city combinations for POI searches to reduce noisy results; use pagination if available for large result sets.
  • Handle API rate limits and error responses gracefully; cache frequently requested district/adcode lookups.

Example use cases

  • "What’s the weather in city X?" — fetch current weather or forecast using the city adcode.
  • "Find coffee shops near Central Park" — run a POI text search scoped to the city or a coordinate radius.
  • "How do I drive from A to B?" — geocode addresses to coordinates then request driving directions between coordinates.
  • "What are the coordinates of 123 Main St?" — use geocoding to return longitude and latitude.
  • "Which district does this coordinate belong to?" — use reverse geocoding to return the structured address and district adcode.

FAQ

How do I supply the Amap API key?

Set the AMAP_KEY environment variable to your Amap Web Service API key before calling the skill.

What format do coordinates need to be in for routing?

Coordinates should be in "longitude,latitude" format for origin and destination parameters.