← Back to Skills Marketplace
coreyleung-art

调用百度地图api功能

by coreyleung-art · GitHub ↗ · v1.0.0
cross-platform ✓ Security Clean
3141
Downloads
4
Stars
16
Active Installs
1
Versions
Install in OpenClaw
/install baidu-map-api
Description
使用百度地图Web服务API进行地点搜索、天气查询、路线规划和地理编码。
README (SKILL.md)

百度地图 (Baidu Map)

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

重要: 使用本技能前,你必须在百度地图开放平台申请一个应用,并获取 Access Key (AK),然后将其设置为环境变量 BAIDU_MAP_AK

export BAIDU_MAP_AK="你的百度地图Access Key"

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

何时使用 (触发条件)

当用户提出以下类型的请求时,应优先使用本技能:

  • "帮我查一下[城市]的天气"
  • "搜索[地点]附近的[东西]"
  • "查找[关键词]的位置"
  • "从[A]到[B]怎么走?"
  • "查询[地址]的经纬度"
  • "这个坐标[经度,纬度]是哪里?"
  • "百度地图[地点]"

核心功能与用法

1. 地点搜索 (POI检索)

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

# 将 [关键词] 替换为用户提供的内容
# region参数可以是城市名或区域名
curl "https://api.map.baidu.com/place/v2/search?query=[关键词]&region=全国&output=json&ak=$BAIDU_MAP_AK"

# 或者指定具体城市
curl "https://api.map.baidu.com/place/v2/search?query=[关键词]&region=广州&output=json&ak=$BAIDU_MAP_AK"

2. 城市内地点搜索

用于在特定城市内搜索地点,结果更精确。

# 将 [关键词] 和 [城市] 替换为实际内容
curl "https://api.map.baidu.com/place/v2/search?query=[关键词]&region=[城市]&output=json&ak=$BAIDU_MAP_AK"

3. 周边搜索 (圆形区域内搜索)

用于在指定坐标点周围搜索特定类型的地点。

# 将 [经度,纬度] 替换为实际坐标,radius为搜索半径(米)
curl "https://api.map.baidu.com/place/v2/search?query=花店&location=[纬度],[经度]&radius=1000&output=json&ak=$BAIDU_MAP_AK"

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

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

# 将 [地址] 替换为用户提供的地址
curl "https://api.map.baidu.com/geocoding/v3/?address=[地址]&output=json&ak=$BAIDU_MAP_AK"

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

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

# 将 [经度,纬度] 替换为实际坐标
curl "https://api.map.baidu.com/reverse_geocoding/v3/?coordtype=wgs84ll&location=[纬度],[经度]&output=json&ak=$BAIDU_MAP_AK"

6. 驾车路线规划

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

# 将 [起点] 和 [终点] 替换为实际地址或坐标
# 起终点可以用地址表示,也可以用经纬度表示
curl "https://api.map.baidu.com/direction/v2/driving?origin=[起点]&destination=[终点]&output=json&ak=$BAIDU_MAP_AK"

# 使用经纬度坐标的示例
curl "https://api.map.baidu.com/direction/v2/driving?origin=39.90923,116.397428&destination=31.230416,121.473701&output=json&ak=$BAIDU_MAP_AK"

7. 步行路线规划

用于规划两个地点之间的步行路线。

# 将 [起点] 和 [终点] 替换为实际地址或坐标
curl "https://api.map.baidu.com/direction/v2/walking?origin=[起点]&destination=[终点]&output=json&ak=$BAIDU_MAP_AK"

8. 公交路线规划

用于规划两个地点之间的公交路线。

# 将 [起点] 和 [终点] 替换为实际地址或坐标
curl "https://api.map.baidu.com/direction/v2/transit?origin=[起点]&destination=[终点]&output=json&ak=$BAIDU_MAP_AK"

9. 行政区划边界查询

用于查询行政区域的边界坐标点集合。

# 将 [行政区名称] 替换为实际的省市区名称
curl "https://api.map.baidu.com/district/v1/getdistrict?qt=dis&level=city&names=[行政区名称]&ak=$BAIDU_MAP_AK"

10. IP定位

根据IP地址获取大致的地理位置信息。

# 将 [IP地址] 替换为实际IP,若不提供则使用当前客户端IP
curl "https://api.map.baidu.com/location/ip?ip=[IP地址]&ak=$BAIDU_MAP_AK"

使用技巧

  1. 搜索半径: 在周边搜索时,可以根据需要调整radius参数,默认1000米
  2. 坐标系统: 百度地图主要使用BD09坐标系,注意与其他坐标系的转换
  3. 结果数量: 默认返回10个结果,可通过page_size参数调整(最大50)
  4. 分页查询: 当结果较多时,可通过page_num参数获取后续页面结果

错误处理

如果API返回错误,通常是以下原因之一:

  • AK无效或未正确设置
  • 请求参数格式错误
  • API调用次数超限
  • 网络连接问题
Usage Guidance
要点提醒: - BAIDU_MAP_AK 是敏感凭据:只在你信任的环境中设置,避免把它泄露到公共日志或共享环境中;撤回或限制该 AK 的权限/配额若发生泄露。 - 本技能会把用户提供的地址、坐标和 IP 发往百度的 api.map.baidu.com;如果你处理高度敏感的地理数据,注意隐私和合规要求。 - 注意 API 调用次数限制和计费(百度地图平台的配额/限制),避免在自动化场景下触发配额或产生费用。 - 技能依赖 curl 在 PATH 中可用;没有安装脚本,所以不会在系统上写入额外代码。 总体上,该技能在用途、所需凭据和运行指令之间是一致的;若你仍有顾虑,可在受控环境中先行测试,并为 BAIDU_MAP_AK 设置最小必要权限与配额。
Capability Analysis
Type: OpenClaw Skill Name: baidu-map-api Version: 1.0.0 The skill bundle is designed to interact with the Baidu Map Web Service API. It uses `curl` to make HTTP requests to legitimate Baidu API endpoints (e.g., `https://api.map.baidu.com/`), authenticating with an Access Key (`BAIDU_MAP_AK`) read from an environment variable. All instructions in `SKILL.md` and `README.md` are directly related to the stated purpose of providing map services. There is no evidence of intentional harmful behavior such as data exfiltration to unauthorized endpoints, malicious execution, persistence mechanisms, or prompt injection instructions against the agent to perform actions outside the skill's stated purpose. The use of `curl` and an API key is expected for this type of functionality.
Capability Assessment
Purpose & Capability
技能名与描述(地点搜索、路线、地理编码等)匹配其运行说明:所有示例都是对 api.map.baidu.com 的 curl 请求,所需资源(curl 和 BAIDU_MAP_AK)与功能一致。没有请求与地图功能无关的凭据或二进制。
Instruction Scope
SKILL.md 明确给出如何用 curl 调用各类百度地图 Web 服务接口。指令仅引用 API URL、请求参数和环境变量 BAIDU_MAP_AK,未要求读取本地文件、其他环境变量或向未说明的外部端点传输数据。
Install Mechanism
这是一个 instruction-only 技能,没有安装脚本或下载行为;风险最低。仅依赖系统上已有的 curl。
Credentials
仅声明一个主要凭据 BAIDU_MAP_AK(用于调用百度地图 API),没有其他不相关的密钥或密码请求。SKILL.md 也只访问 BAIDU_MAP_AK。该级别的凭据请求与技能目的相称。
Persistence & Privilege
技能没有设置 always:true,也不包含修改其他技能或系统配置的指令。默认允许模型自主调用(平台默认),但这与技能内容和权限范围一致,未放大特权。
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install baidu-map-api
  3. After installation, invoke the skill by name or use /baidu-map-api
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
baidu-map v1.0.0 — 初始版本 - 新增通过百度地图 Web 服务 API 提供的功能,包括地点搜索、天气查询、路线规划、地理/逆地理编码、行政区划查询和IP定位。 - 提供详细用法示例,以及常见触发场景和常见错误说明。 - 支持多种地理位置服务,如驾车/步行/公交路线规划及周边搜索。 - 需要配置 Access Key 环境变量 BAIDU_MAP_AK。 - 说明了参数调整和分页等使用技巧。
Metadata
Slug baidu-map-api
Version 1.0.0
License
All-time Installs 17
Active Installs 16
Total Versions 1
Frequently Asked Questions

What is 调用百度地图api功能?

使用百度地图Web服务API进行地点搜索、天气查询、路线规划和地理编码。 It is an AI Agent Skill for Claude Code / OpenClaw, with 3141 downloads so far.

How do I install 调用百度地图api功能?

Run "/install baidu-map-api" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is 调用百度地图api功能 free?

Yes, 调用百度地图api功能 is completely free (open-source). You can download, install and use it at no cost.

Which platforms does 调用百度地图api功能 support?

调用百度地图api功能 is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created 调用百度地图api功能?

It is built and maintained by coreyleung-art (@coreyleung-art); the current version is v1.0.0.

💬 Comments