中华人民共和国行政区划代码
中华人民共和国行政区划(五级):省级、地级、县级、乡级和村级。
来自中华人民共和国民政部,用于查询中国省,市和区数据的网站。
Github: https://github.com/uiwjs/province-city-china
数据更新 Diff
安装
npm install province-city-china --save-dev
使用
const { data, province, city, area, town } = require('province-city-china/data');
data
- 总数据(省/地/县/乡)province
- 省级(省/直辖市/特别行政区)city
- 地级(城市)area
- 县级(区县)town
- 乡级(乡镇/街)
所有数据
const provinces = require('province-city-china/dist/data.json');
// provinces 输出 ===>
[
{"code":"110000","name":"北京市","province":"11","city":0,"area":0,"town":0},
{"code":"110101","name":"东城区","province":"11","city":"01","area":"01","town":0},
{"code":"110102","name":"西城区","province":"11","city":"01","area":"02","town":0},
{"code":"110105","name":"朝阳区","province":"11","city":"01","area":"05","town":0},
....
]
规则:
province - 省级(省/直辖市/特别行政区)
-city=0
,area=0
,town=0
city - 地级(城市)
-area=0
,town=0
area - 县级(区县)
-town=0
其它不为0
town - 乡级(乡镇/街)
- 所有值不为0
province
第一位表示:华北区1
,东北区2
,华东区3
,中南区4
,西南区5
,西北区6
。 如湖北省 -> 42
以4
开头,表示为中南区
。
获取城市数据
const city = require('province-city-china/dist/city.json');
// city 输出 ===>
[
{"code":"01","name":"石家庄市","province":"13"},
{"code":"02","name":"唐山市","province":"13"},
{"code":"03","name":"秦皇岛市","province":"13"},
{"code":"04","name":"邯郸市","province":"13"},
{"code":"05","name":"邢台市","province":"13"},
....
]
说明:
code
- 城市代码name
- 城市名称province
- 省/直辖市/特别行政区代码
更多数据
可以通过 UNPKG 下载使用
CDN
资源: https://unpkg.com/province-city-china/dist/
文件列表 | JSON | CSV | SQL | CDN |
---|---|---|---|---|
总数据(省/地/县/乡) | data.json | data.csv | data.sql | data.sql / csv / json |
省/地/县/乡层级数据 | level.json | - | - | level.json |
省级(省/直辖市/特别行政区) | province.json | province.csv | - | province.json / csv |
地级(城市) | city.json | city.csv | - | city.json / csv |
县级(区县) | area.json | area.csv | - | area.json / csv |
乡级(乡镇/街) | town.json | town.csv | - | town.json / csv |
更多 CDN 数据访问
- https://unpkg.com/province-city-china/dist/city.json
- https://raw.githack.com/uiwjs/province-city-china/gh-pages/city.json
- https://cdn.statically.io/gh/uiwjs/province-city-china/gh-pages/city.json
总数据(省/地/县/乡)
data.json | data.csv | data.sql
[
{
"code": "110000",
"name": "北京市",
"province": "11",
"city": 0,
"area": 0,
"town": 0
},
]
省/地/县/乡层级数据