Skip to main content

地理编码工具 — 高德地图 API 地址 → 坐标 + GeoJSON

Project description

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

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

geocode_amap-0.2.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

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

geocode_amap-0.2.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file geocode_amap-0.2.0.tar.gz.

File metadata

  • Download URL: geocode_amap-0.2.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for geocode_amap-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6bbb86693d83af3000f80fe392645d3f9f17fceabfe0c3170f457409e3852744
MD5 e9064331ab65e1f59fbc03a5af542287
BLAKE2b-256 312a79cd7ec4c00bfd8d49f2d58efc56ce8cbec1e633589f3ab82310f571d260

See more details on using hashes here.

File details

Details for the file geocode_amap-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: geocode_amap-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for geocode_amap-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bb84cb135833dd22a588d194f5f1292786bf7819b089f32bf0f46b2bfeb1b8d2
MD5 98fb4f32b91753490af355c9edc61f9f
BLAKE2b-256 02414b9d3633d24aca7a65c2890d865902c1811c52721553934667cb394c58c5

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