Skip to main content

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

Project description

amap-sdk-python

PyPI version Python License: MIT Tests

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

from amap import AmapClient

# Via environment variable AMAP_MAPS_API_KEY, or pass directly:
client = AmapClient(api_key="your_api_key")

# Geocoding
result = client.geocoding.geocode("北京市朝阳区阜通东大街6号")

# POI search (v5)
pois = client.poi.text_search("火锅", city="重庆")

# Weather
weather = client.weather.get_weather("110101")  # adcode for 东城区

# Routing
route = 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

Module Attribute Description
Geocoding client.geocoding Address ↔ coordinate conversion
POI (v5) client.poi Place search: text, nearby, polygon, detail
Weather client.weather Current weather and forecasts
District client.district Administrative region queries
Input Tips client.inputtips Search autocomplete suggestions
Distance client.distance Distance measurement between points
Direction client.direction Walk, drive, transit, bicycle routing
Static Map client.staticmap Static map image generation (PNG)
Coordinate client.coordinate Coordinate system conversion (GPS/Baidu → GCJ-02)
Traffic client.traffic Real-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_API_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。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

amap_sdk-0.1.0.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

amap_sdk-0.1.0-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file amap_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: amap_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for amap_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 41ad91cf9ae676ffe5155f3640c00f3742ec88c8647be71a0dccb135f7112763
MD5 7a386a76e1eef2e8f652c03a6adc7a14
BLAKE2b-256 0f3b9b7a2190c38d4685ccd1a142af6c10135b8e34cf764a2e339f8dda5fa5d8

See more details on using hashes here.

File details

Details for the file amap_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: amap_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for amap_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0d60a3fe51e02c0c4aa329b6f29dcd9819c587b4e9c1b7adc4ed9304a5a207df
MD5 c1082ce15d7b4d94ec99e318cb7d6988
BLAKE2b-256 9dfb715e9ba8af920674fc03defcb7e393e190bd8b47ddeb7b3623cd8b9129a9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page