更适合中国体质宝宝的地图搜索工具,支持高德、百度、腾讯地图聚合搜索。
多地图聚合搜索工具,支持高德、百度、腾讯。
python
#!/usr/bin/env python3
地图搜索工具
import os
import json
import requests
# 回退到环境变量
return {
api_keys: {
amap: os.getenv(AMAPAPIKEY, ),
baidu: os.getenv(BAIDUMAPAPI_KEY, ),
tencent: os.getenv(TENCENTMAPAPI_KEY, )
},
priority: [amap, tencent, baidu]
}
AMAPKEY = APIKEYS[amap]
BAIDUKEY = APIKEYS[baidu]
TENCENTKEY = APIKEYS[tencent]
results = {}
# 高德搜索
if amap in priority and AMAP_KEY:
url = fhttps://restapi.amap.com/v3/place/text?key={AMAP_KEY}&keywords={keyword}&city={region}&output=json
r = requests.get(url, timeout=5).json()
if r.get(status) == 1:
results[高德] = [{name: p[name], address: p[address], location: p[location]}
for p in r.get(pois, [])[:5]]
# 百度搜索
if baidu in priority and BAIDU_KEY:
url = fhttps://api.map.baidu.com/place/v2/search?query={keyword}®ion={region}&ak={BAIDU_KEY}&output=json
r = requests.get(url, timeout=5).json()
if r.get(status) == 0:
results[百度] = [{name: p[name], address: p.get(address, ), location: p.get(location, )}
for p in r.get(results, [])[:5]]
# 腾讯搜索
if tencent in priority and TENCENT_KEY:
url = fhttps://apis.map.qq.com/ws/place/v1/search?keyword={keyword}®ion={region}&key={TENCENT_KEY}&output=json
r = requests.get(url, timeout=5).json()
if r.get(status) == 0:
results[腾讯] = [{name: p[name], address: p.get(address, ), location: p.get(location, )}
for p in r.get(data, [])[:5]]
return results
results = search_maps(keyword, region)
for source, items in results.items():
print(f\n【{source}】)
for i, item in enumerate(items, 1):
print(f {i}. {item[name]})
print(f 地址: {item[address]})
路径: ~/.config/openclaw/map_config.json
json
{
amap: {
api_key: 你的高德API Key
},
baidu: {
api_key: 你的百度API Key
},
tencent: {
api_key: 你的腾讯API Key
},
priority: [amap, tencent, baidu]
}
按数组顺序搜索,找到一个有效结果就停止。
如果配置文件不存在,会回退到环境变量:
bash
export AMAPAPIKEY=你的高德Key
export BAIDUMAPAPI_KEY=你的百度Key
export TENCENTMAPAPI_KEY=你的腾讯Key
| 平台 | 地址 |
|---|---|
| 高德 | https://lbs.amap.com/ |
| 百度 |
【高德】
1. 星巴克(人民广场店)
地址: 黄浦区南京西路123号
2. 瑞幸咖啡(来福士店)
地址: 黄浦区西藏中路268号
🔍 附近搜索: 咖啡馆 (半径 2000 米)
正在获取当前位置...
当前位置: 经度 121.47, 纬度 31.23
【高德】
1. 星巴克(人民广场店)
地址: 黄浦区南京西路123号
距离: 520米
2. 瑞幸咖啡(来福士店)
地址: 黄浦区西藏中路268号
距离: 890米
| 参数 | 说明 | 示例 |
|---|---|---|
| --nearby 或 -n | 启用附近搜索模式 | --nearby |
| -k 或 --keyword |
| 场景 | 命令 |
|---|---|
| 搜附近咖啡馆 | map-search --nearby -k 咖啡馆 |
| 搜附近1公里的火锅 |
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 map-search-1776420071 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 map-search-1776420071 技能
skillhub install map-search-1776420071
文件大小: 5.53 KB | 发布时间: 2026-4-17 20:00