Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hanwentao/china-regions
Data of China's Regions
https://github.com/hanwentao/china-regions
china data geography
Last synced: 3 months ago
JSON representation
Data of China's Regions
- Host: GitHub
- URL: https://github.com/hanwentao/china-regions
- Owner: hanwentao
- Created: 2020-02-20T08:15:28.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-21T08:38:24.000Z (about 4 years ago)
- Last Synced: 2024-10-12T21:08:44.997Z (4 months ago)
- Topics: china, data, geography
- Language: Python
- Size: 136 KB
- Stars: 3
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 中国行政区划数据
本项目将民政部公布的中国行政区划数据结构化,可作为地点控件的参考数据。
## 数据来源
原始数据来自于[中华人民共和国民政部-行政区划代码](http://www.mca.gov.cn/article/sj/xzqh/)。获取方法:
xargs -n 1 curl -s data/places.txt
这里用到了 [html2text](http://alir3z4.github.io/html2text/) 工具。或者,也可以用浏览器访问[该网页](http://www.mca.gov.cn/article/sj/xzqh/),访问最新的“县以上区划变更情况”网页,然后把文字内容复制粘贴到 `data/places.txt` 文件中。
## 数据文件
* `data/regions.json`:JSON 格式的中国县以上行政区划数据,本身是一个数组,元素为省级行政区划,元素字段包括
+ `code`:行政区划的 6 位数字代码
+ `name`:行政区划的名称
+ `subregions`(可选):下级行政区划数据,格式同上
* `data/locations.csv`:CSV 格式的中国县以上行政区划数据,包含三个字段
+ `code`:行政区划的 6 位数字代码
+ `name`:行政区划的名称
+ `full_name`:行政区划的全称,一般包含省、地、县三部分
* `data/locations.txt`:纯文本格式,每行包括一条中国县以上行政区划的全称,包括县以上的下级行政区划的行政区划不列出。## 处理脚本
* `generate_regions.py`:从 `data/places.txt` 产生 `data/regions.json` 的 Python 脚本
* `parse_places.py`:从 `data/places.txt` 产生 `data/locations.csv` 的 Python 脚本
* `dump_locations.py`:从 `data/regions.json` 产生 `data/locations.txt` 的 Python 脚本