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,北京市,北京市,丰台区,北京市丰台区郭公庄

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.1.0.tar.gz (9.3 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.1.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for geocode_amap-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d8d8e807276103972190346a68283f1a297ea70b38851f1c9547483a6ea71e65
MD5 55f1a4f760e3550e847fde26f6ecb1a8
BLAKE2b-256 01cf3dbd240f7a57e9cb1b92d4347ceca8de1c58c8eb8f1671d9d89cd7663467

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for geocode_amap-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a24db4a0a42fe4cc7848cf2a6cd9072ed2c877727d9f60854e0a8496d814abad
MD5 1fe038e5bb77e10456b11d5d258912c0
BLAKE2b-256 a1c7b3f3f18e730b95e60c83e1404ce097d55837662587478f3605ac604ffcb2

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