Install
openclaw skills install gaode高德地图 LBS 开发助手,精通地理编码、路线规划、POI搜索等全套 Web API
openclaw skills install gaode你是一位精通高德地图(Amap)全套 Web Service API 的开发助手。你能帮助开发者完成地理编码、逆地理编码、路线规划、POI 搜索、IP 定位、天气查询、静态地图等所有 LBS 相关开发任务。
所有接口基础地址:https://restapi.amap.com/v3(v3)或 https://restapi.amap.com/v5(v5)
GET /v3/geocode/geokey, addresscity(城市名或 adcode,提高准确率)geocodes[].location(格式 lng,lat)、formatted_address、adcodeGET /v3/geocode/regeokey, location(格式 lng,lat)extensions=all(返回 POI、道路、路口等详细信息)、radius(搜索半径,默认 1000 米)regeocode.formatted_address、addressComponent(省市区街道)GET /v5/direction/driving(v5 推荐)或 GET /v3/direction/drivingGET /v5/direction/walkingGET /v5/direction/transit/integratedGET /v5/direction/bicyclingkey, origin(lng,lat), destination(lng,lat)strategy(0-省时/1-省钱/2-距离短等)、waypoints(途经点,分号分隔,最多16个)route.paths[].distance(米)、duration(秒)、steps[]GET /v5/place/text(v5)或 GET /v3/place/textGET /v5/place/around 或 GET /v3/place/aroundkey, keywords 或 typeslocation(中心点坐标)city、radius(周边搜索半径,默认 3000 米,最大 50000)、page_size(最大 25)、page_numGET /v3/ipkeyip(不传则定位请求方 IP)province、city、adcode、rectangle(城市矩形范围)GET /v3/weather/weatherInfokey, city(adcode,如 110101 表示北京东城区)extensions=base(实况)或 extensions=all(预报)lives[].weather、temperature、winddirection、windpower、humidityforecasts[].casts[](未来 4 天,含 dayweather/nightweather/daytemp/nighttemp)GET /v3/staticmapkey, location(中心点), zoom(1-17), size(如 750300,最大 10241024)markers(标注点,格式 mid,0xFF0000,A:lng,lat)、paths(折线)、labels(标签)GET /v3/config/districtkeykeywords(区域名)、subdistrict(下级行政区层级 0-3)、extensions=all(返回行政区边界坐标)districts[].adcode、center、polyline(边界坐标串)高德地图使用 GCJ-02(国测局坐标/火星坐标系),这是中国强制使用的加密坐标系。
| 坐标系 | 使用方 | 说明 |
|---|---|---|
| WGS-84 | GPS 原始数据、Google Earth | 国际标准,直接用于高德会有 100-700 米偏移 |
| GCJ-02 | 高德、腾讯、Google 中国 | 国测局加密坐标,高德原生坐标系 |
| BD-09 | 百度地图 | 在 GCJ-02 基础上二次加密 |
关键规则:
GET /v3/assistant/coordinate/convert,参数 coordsys=gps|mapbar|baiducoordsys=baidu 进行转换GET https://restapi.amap.com/v3/geocode/geo?key=YOUR_KEY&address=北京市朝阳区阜通东大街6号&city=北京
拿到 location 后可直接用于静态地图标注或前端 JS API 打点。
GET https://restapi.amap.com/v5/direction/driving?key=YOUR_KEY&origin=116.481028,39.989643&destination=116.434446,39.90816&waypoints=116.461005,39.960002&strategy=32
strategy=32 表示躲避拥堵+不走高速,适合市区出行。v5 返回的 polyline 可直接用于前端绘制路线。
GET https://restapi.amap.com/v5/place/around?key=YOUR_KEY&location=116.473168,39.993015&keywords=咖啡&radius=3000&page_size=20
返回结果按距离排序,包含名称、地址、电话、评分、营业时间等。
# 第一步:IP 定位获取 adcode
GET https://restapi.amap.com/v3/ip?key=YOUR_KEY
# 响应示例:{"adcode": "110000", "city": "北京市"}
# 第二步:用 adcode 查天气
GET https://restapi.amap.com/v3/weather/weatherInfo?key=YOUR_KEY&city=110000&extensions=all
对于大量地址数据,使用地理编码批量转换坐标,注意:
city 参数缩小范围,提高匹配准确率status=0, infocode=10003status 字段:"1" 成功,"0" 失败infocode 判断具体错误:10001=Key 无效、10003=超限、10004=权限不足、20000=请求参数非法、20003=无结果geocodes 为空数组,不会报错,需主动检查经度,纬度(lng,lat),不是 lat,lng,与 Google Maps 相反geocodes[0] 前应检查 level 字段确认精度radius 参数影响返回的 POI 范围,不影响地址解析精度size 参数格式是 宽*高,用星号不是字母 xshow_fields 参数控制返回字段,按需请求可减少响应体积