geocode-amap
高德地图 API 地理编码工具 — 地址 → 坐标,输出 GeoJSON / CSV。
安装
pip install geocode-amap
配置
export AMAP_API_KEY_S=your_amap_key
使用
# 单个地址
geocode-amap "成都市武侯区阳光幼儿园"
# 批量 — 文件(一行一个,# 注释)
geocode-amap addresses.txt
# 指定输出
geocode-amap addresses.txt -o result.geojson
# CSV 格式
geocode-amap addresses.txt --format csv
# 跳过逆地理编码(更快)
geocode-amap addresses.txt --no-reverse
子命令
geocode-amap search — POI 搜索
geocode-amap search "星巴克" -c 北京 -n 10
geocode-amap search "加油站" -c 成都 --csv
POI GeoJSON 字段
{
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"geometry": { "type": "Point", "coordinates": [lon, lat] },
"properties": {
"id": "B001C051A4", // 高德 POI ID
"name": "星巴克(太古里店)", // 名称
"type": "餐饮服务;咖啡厅", // 类别
"typecode": "050300", // 类别代码
"location": "104.080,30.650", // lon,lat
"lon": 104.080, // 经度
"lat": 30.650, // 纬度
"address": "太古里1层", // 地址
"cityname": "成都市", // 城市
"adname": "锦江区", // 区县
"pname": "四川省", // 省份
"tel": "028-88888888", // 电话
"distance": "150" // 距中心点距离(米)
}
}]
}
输出
地理编码 GeoJSON (geocode + reverse)
| 字段 | 来源 | 类型 | 说明 |
|---|---|---|---|
name |
输入 | string | 查询地址 |
query_time |
本地 | string | 查询时间 (ISO 8601) |
location |
geocode | string | lon,lat |
formatted_address |
geocode | string | 结构化地址 |
province |
geocode | string | 省 |
city |
geocode | string | 市 |
district |
geocode | string | 区/县 |
adcode |
geocode | string | 行政区划代码 |
level |
geocode | string | 匹配级别 (省/市/区县/兴趣点) |
regeo_formatted |
reverse | string | 逆地理编码完整地址 |
township |
reverse | string | 街道/乡镇 |
citycode |
reverse | string | 城市区号 |
roads |
reverse | array | 周边道路 [{name, distance, direction}] |
nearby_pois |
reverse | array | 周边POI [{name, type, address, tel, distance}] |
CSV 格式
| 列 | 来源 | 说明 |
|---|---|---|
name |
输入 | 查询地址 |
lon |
geocode | 经度 (WGS-84) |
lat |
geocode | 纬度 (WGS-84) |
province |
geocode | 省 |
city |
geocode | 市 |
district |
geocode | 区/县 |
address |
geocode | 结构化地址 |
name,lon,lat,province,city,district,address
郭公庄,116.301403,39.812832,北京市,北京市,丰台区,北京市丰台区郭公庄
POI 类别参考 (49)
用于 cityposter --custom-poi 的 category 字段。
| 类别 | 中文 | English |
|---|---|---|
accommodation |
住宿 | Accommodation |
airport |
机场 | Airport |
art_gallery |
美术馆 | Art Gallery |
bakery |
面包店 | Bakery |
bank |
银行 | Bank |
bar |
酒吧 | Bar |
bbq |
烧烤 | BBQ |
beach |
海滩 | Beach |
bookstore |
书店 | Bookstore |
bus_station |
公交站 | Bus Station |
cafe |
咖啡厅 | Cafe |
camping_site |
露营地 | Camping Site |
church |
教堂 | Church |
cinema |
电影院 | Cinema |
cultural_street |
文化街区 | Cultural Street |
fitness_center |
健身中心 | Fitness Center |
forest |
森林 | Forest |
garden |
花园 | Garden |
historical_site |
历史遗址 | Historical Site |
hospital |
医院 | Hospital |
hotpot |
火锅 | Hotpot |
ktv |
KTV | KTV |
lake |
湖泊 | Lake |
landmark |
地标 | Landmark |
mall |
商场 | Mall |
market |
市场 | Market |
mountain |
山峰 | Mountain |
museum |
博物馆 | Museum |
park |
公园 | Park |
pharmacy |
药房 | Pharmacy |
police_station |
派出所 | Police Station |
port |
港口 | Port |
post_office |
邮局 | Post Office |
resort |
度假村 | Resort |
restaurant |
餐厅 | Restaurant |
school |
学校 | School |
sightseeing_spot |
景点 | Sightseeing |
snack_bar |
小吃店 | Snack Bar |
souvenir_shop |
纪念品店 | Souvenir Shop |
spa_wellness |
水疗 | Spa & Wellness |
subway_station |
地铁站 | Subway Station |
tea_shop |
茶馆 | Tea Shop |
temple |
寺庙 | Temple |
theater |
剧院 | Theater |
theme_park |
主题公园 | Theme Park |
train_station |
火车站 | Train Station |
university |
大学 | University |
waterfall |
瀑布 | Waterfall |
zoo_aquarium |
动物园/水族馆 | Zoo/Aquarium |
License
MIT
Metadata
Release files for geocode-amap 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| geocode_amap-0.2.0.tar.gz | 11.9 kB | Without provenance | Details for geocode_amap-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| geocode_amap-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for geocode_amap-0.2.0-py3-none-any.whl |
Total release size: 22.4 kB
Release files / geocode_amap-0.2.0.tar.gz
| Download URL | geocode_amap-0.2.0.tar.gz |
|---|---|
| Size | 11.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6bbb86693d83af3000f80fe392645d3f9f17fceabfe0c3170f457409e3852744
|
|
BLAKE2b-256 checksum How to use checksums |
312a79cd7ec4c00bfd8d49f2d58efc56ce8cbec1e633589f3ab82310f571d260
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / geocode_amap-0.2.0-py3-none-any.whl
| Download URL | geocode_amap-0.2.0-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bb84cb135833dd22a588d194f5f1292786bf7819b089f32bf0f46b2bfeb1b8d2
|
|
BLAKE2b-256 checksum How to use checksums |
02414b9d3633d24aca7a65c2890d865902c1811c52721553934667cb394c58c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Security for geocode-amap 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.