Skip to content

Repository files navigation

amap-sdk-python

PyPI versionPythonLicense: MITTests

Python SDK for the Amap (高德地图) Web Service REST API.

Disclaimer: This is an unofficial, community-maintained SDK. 高德地图 is a trademark of AutoNavi Software Co., Ltd. (Alibaba Group). This project is not affiliated with or endorsed by Amap/AutoNavi.

Features

  • 10 API modules covering geocoding, POI search, routing, weather, and more
  • POI search uses the latest v5 API
  • Type-annotated, minimal dependencies (requests only)
  • Comprehensive test suite (68 unit + 4 integration tests)

Installation

pip install amap-sdk

For development:

git clone https://github.com/Horacehxw/amap-sdk-python.git
cd amap-sdk-python
pip install -e ".[dev]"

Quick Start

fromamapimportAmapClient# Via environment variable AMAP_MAPS_KEY, or pass directly:client=AmapClient(api_key="your_api_key")
# Geocodingresult=client.geocoding.geocode("北京市朝阳区阜通东大街6号")
# POI search (v5)pois=client.poi.text_search("火锅", city="重庆")
# Weatherweather=client.weather.get_weather("110101") # adcode for 东城区# Routingroute=client.direction.driving("116.481028,39.989643", "116.465302,40.004717")
# Static map (returns PNG bytes)img=client.staticmap.get_map(location="116.481028,39.989643", zoom=15)

Get your API key from the Amap Developer Portal.

API Modules

ModuleAttributeDescription
Geocodingclient.geocodingAddress ↔ coordinate conversion
POI (v5)client.poiPlace search: text, nearby, polygon, detail
Weatherclient.weatherCurrent weather and forecasts
Districtclient.districtAdministrative region queries
Input Tipsclient.inputtipsSearch autocomplete suggestions
Distanceclient.distanceDistance measurement between points
Directionclient.directionWalk, drive, transit, bicycle routing
Static Mapclient.staticmapStatic map image generation (PNG)
Coordinateclient.coordinateCoordinate system conversion (GPS/Baidu → GCJ-02)
Trafficclient.trafficReal-time traffic status (road, circle, rectangle)

Testing

# Unit tests (no API key needed)
pytest -v
# Skip integration tests
pytest -v -m "not integration"# Integration tests (requires real API key)
AMAP_MAPS_KEY=your_key pytest -v -m integration

License

MIT


中文说明

高德地图 Web Service REST API 的 Python SDK,覆盖地理编码、POI 搜索、路线规划、天气查询等 10 个模块。

安装:

pip install amap-sdk

特性:

  • POI 搜索使用最新 v5 API
  • 完整类型注解,仅依赖 requests
  • 72 个测试(68 单元 + 4 集成),无需 API Key 即可运行单元测试
  • 支持坐标系转换(GPS/百度 → GCJ-02)

使用前需要:高德开放平台注册并获取 API Key。

About

Python SDK for the Amap (高德地图) Web Service REST API — geocoding, POI, routing, weather & more

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages