Install
openclaw skills install amap-navigation提供基于高德地图的路线规划、实时路况、公交与打车估价及周边POI搜索的出行导航服务。
openclaw skills install amap-navigation版本: v1.0.0
作者: 玉斧 (wangyuqin2@xiaohongshu.com)
类别: 出行导航
区域: 中国
高德地图导航与出行助手。支持路线规划、实时路况、打车估价、POI搜索、距离计算。
当用户询问以下内容时激活:
# 基础用法
node scripts/navigation.js \
--from "浙江省杭州市西湖区" \
--to "浙江省杭州市滨江区阿里巴巴西溪园区" \
--mode driving
# 公交路线
node scripts/navigation.js \
--from "北京站" \
--to "首都机场" \
--mode transit \
--prefer "least-time"
# 多方案对比
node scripts/navigation.js \
--from "上海虹桥火车站" \
--to "上海浦东机场" \
--mode driving \
--alternatives 3
# 搜索附近餐厅
node scripts/poi_search.js \
--keyword "川菜" \
--location "北京市朝阳区三里屯" \
--radius 1000
# 搜索加油站
node scripts/poi_search.js \
--type "加油站" \
--location "上海市浦东新区陆家嘴" \
--sort distance
# 估算打车费用
node scripts/taxi_estimate.js \
--from "杭州东站" \
--to "西湖风景区" \
--platforms "didi,gaode"
const AMapNavigation = require('./scripts/navigation.js');
// 路线规划
const route = await AMapNavigation.planRoute({
origin: '116.481028,39.989643', // 经纬度或地址
destination: '116.434446,39.90816',
mode: 'driving', // driving, transit, walking, bicycling
strategy: 'fastest' // fastest, shortest, no-highway
});
// POI搜索
const pois = await AMapNavigation.searchPOI({
keyword: '星巴克',
location: '上海市静安区',
radius: 2000,
limit: 10
});
// 打车估价
const estimate = await AMapNavigation.estimateTaxi({
from: '北京南站',
to: '天安门广场',
platforms: ['didi', 'gaode']
});
| 参数 | 必填 | 默认值 | 说明 |
|---|---|---|---|
--from | ✅ | - | 出发地(地址或经纬度) |
--to | ✅ | - | 目的地(地址或经纬度) |
--mode | ❌ | driving | 出行方式:driving/transit/walking/bicycling |
--strategy | ❌ | fastest | 路线偏好:fastest/shortest/no-highway |
--alternatives | ❌ | 1 | 方案数量(1-3) |
--avoid | ❌ | - | 避开拥堵/高速/收费站 |
| 参数 | 必填 | 默认值 | 说明 |
|---|---|---|---|
--keyword | ✅ | - | 搜索关键词 |
--location | ✅ | - | 搜索中心点 |
--radius | ❌ | 1000 | 搜索半径(米) |
--type | ❌ | - | POI类型(餐饮/酒店/加油站) |
--sort | ❌ | distance | 排序方式:distance/rating |
--limit | ❌ | 10 | 结果数量 |
| 参数 | 必填 | 默认值 | 说明 |
|---|---|---|---|
--from | ✅ | - | 出发地 |
--to | ✅ | - | 目的地 |
--platforms | ❌ | gaode | 平台:gaode/didi/kuaiche/zhuanche |
--carpool | ❌ | false | 是否拼车 |
{
"status": "success",
"mode": "driving",
"routes": [
{
"name": "方案1(推荐)",
"distance": "15.2 km",
"duration": "28分钟",
"traffic": "畅通",
"toll": "0元",
"strategy": "时间最短",
"steps": [
"从起点出发,沿XX路向北行驶500米",
"右转进入XX路,行驶2.3公里"
]
}
],
"recommendation": "建议选择方案1,预计28分钟到达,当前路况畅通"
}
{
"status": "success",
"total": 15,
"pois": [
{
"name": "星巴克(静安店)",
"address": "上海市静安区XX路123号",
"distance": "350米",
"rating": 4.5,
"phone": "021-12345678",
"hours": "08:00-22:00",
"price": "¥30-50/人"
}
]
}
{
"status": "success",
"estimates": [
{
"platform": "高德打车",
"service": "快车",
"price": "¥25-30",
"duration": "18分钟",
"distance": "8.5 km"
},
{
"platform": "滴滴出行",
"service": "快车",
"price": "¥28-33",
"duration": "20分钟",
"distance": "8.5 km"
}
],
"recommendation": "推荐使用高德打车快车,价格最优"
}
在工作区根目录 .env 文件中配置:
# 高德地图 API Key(必需)
AMAP_API_KEY=your_api_key_here
# 可选配置
AMAP_API_SECRET=your_secret_here # 部分API需要
AMAP_BASE_URL=https://restapi.amap.com # 默认值
.env 文件免费额度:
// 地址解析失败
{
"status": "error",
"code": "GEOCODE_FAILED",
"message": "无法解析地址:XX路XX号"
}
// API Key 无效
{
"status": "error",
"code": "INVALID_API_KEY",
"message": "请在 .env 文件中配置有效的 AMAP_API_KEY"
}
// 无可用路线
{
"status": "error",
"code": "NO_ROUTE",
"message": "未找到从A到B的可行路线"
}
# 用户:"从家到公司最快路线"
node scripts/navigation.js \
--from "北京市朝阳区XX小区" \
--to "北京市海淀区中关村软件园" \
--mode driving \
--strategy fastest \
--alternatives 3
# 输出:
# - 方案1:三环-四环路线,28分钟,轻微拥堵
# - 方案2:走五环绕行,35分钟,畅通
# - 建议:选择方案1,虽有拥堵但仍最快
# 用户:"附近有什么好吃的川菜馆"
node scripts/poi_search.js \
--keyword "川菜" \
--location "当前位置" \
--radius 2000 \
--sort rating \
--limit 5
# 输出:
# 1. 巴蜀风味(4.8星,500米)
# 2. 蜀香阁(4.6星,800米)
# 3. 川渝人家(4.5星,1.2公里)
# 用户:"从机场到酒店打车多少钱"
node scripts/taxi_estimate.js \
--from "首都机场T3航站楼" \
--to "北京朝阳区XX酒店" \
--platforms "didi,gaode"
# 输出:
# 高德打车:¥85-95,50分钟
# 滴滴出行:¥88-98,52分钟
# 建议:高德打车略便宜,预计50分钟到达
https 模块(API调用)/v5/direction/{mode}/v3/geocode/geo/v5/place/text/v5/direction/distanceAPI Key 安全
调用频率
坐标系统
隐私保护
路线方案 + 时间距离 + 实时路况 + 出行建议
MIT License
ClawHub 生态贡献
填补中国本土化出行服务空白