中华人民共和国行政区划(五级):省级、地级、县级、乡级和村级。来自中华人民共和国民政部,用于查询**省,市和区数据的网站。
数据更新时间:2021/05/11 09:55:00 GMT+0800 (**标准时间)
- 数据更新 2021/05/11
- 数据更新 2020/11/24
- 数据更新 2020/11/05
- 数据更新 2020/07/28 县以上行政区【没变】,县以下发生变更
- 数据更新 2020/03/30
- 数据更新 2020/03/06
- 数据更新 2019/12/24
- 数据更新 2019/11/25
- 数据更新 2019/11/05
- 数据更新 2019/06/21
npm install province-city-china --save-dev
包名 | 说明 | 版本 | 大小 |
---|---|---|---|
province-city-china | 包含所有包内容 | - | |
@province-city-china/country | 国家和地区代码列表 | ||
@province-city-china/data | 总数据(省/地/县/乡) | ||
@province-city-china/province | 省级(省/直辖市/特别行政区) | ||
@province-city-china/city | 地级(城市) | ||
@province-city-china/area | 县级(区县) | ||
@province-city-china/town | 乡级(乡镇/街) | ||
@province-city-china/level | 总数据(省/地/县/乡)层级数据 | ||
@province-city-china/utils | 提供使用数据方法 | ||
@province-city-china/types | 类型文件 | - |
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 |
---|---|---|---|---|
国家和地区代码列表(#13) | country.json (min) | country.csv | - | csv / json |
总数据(省/地/县/乡) | data.json (min) | data.csv | data.sql | data.sql / csv / json |
总数据(省/地/县/乡)层级数据 | level.json (min) | - | - | level.json |
省级(省/直辖市/特别行政区) | province.json (min) | province.csv | - | province.json / csv |
地级(城市) | city.json (min) | city.csv | - | city.json / csv |
县级(区县) | area.json (min) | area.csv | - | area.json / csv |
乡级(乡镇/街) | town.json (min) | town.csv | - | town.json / csv |
县市区没有乡级数据 | cityNotFoundTown.json (min) | - | - | cityNotFoundTown.json |
更多 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
> <省市区>数据:3212
✔ 数据保存: dist/data.json
> <省>数据:34
✔ 数据保存: dist/province.json
✔ 数据保存: dist/province.csv
> <市>数据:333
✔ 数据保存: dist/city.json
✔ 数据保存: dist/city.csv
> <区>数据:2845
✔ 数据保存: dist/area.json
✔ 数据保存: dist/area.csv
> 省市区:数据生成完成!
country.json | country.min.json | country.csv
id=序号、cnname=中文简称、name=英文简称、fullname=英文全称、alpha2=两字母代码、alpha3=三字母代码、numeric=数字代码
[
{
"id": 1,
"cnname": "阿富汗",
"name": "Afghanistan",
"fullname": "the Islamic Republic of Afghanistan",
"alpha2": "AF",
"alpha3": "AFG",
"town": 4
},
{
"id": 45,
"cnname": "**",
"name": "China",
"fullname": "the People's Republic of China",
"alpha2": "CN",
"alpha3": "CHN",
"town": 156
}
// ...
]
压缩数据说明 country.min.json
id: 'i'
cnname: 'c'
name: 'n'
fullname: 'f'
alpha2: 'a2'
alpha3: 'a3'
numeric: 'r'
data.json | data.min.json | data.csv | data.sql
[
{
"code": "110000",
"name": "北京市",
"province": "11",
"city": 0,
"area": 0,
"town": 0
},
// ...
]
压缩数据说明 data.min.json
code: 'c'
name: 'n'
province: 'p'
city: 'y'
area: 'a'
town: 't'
[
{
"code": "420000",
"name": "湖北省",
"province": "42",
"children": [
{
"code": "420100",
"name": "武汉市",
"province": "42",
"city": "01",
"children": [
{
"code": "420102",
"name": "江岸区",
"province": "42",
"city": "01",
"area": "02"
},
// ...
]
}
// ...
]
}
// ...
]
压缩数据说明 level.min.json
code: 'c'
name: 'n'
province: 'p'
city: 'y'
area: 'a'
children: 'd'
province.json | province.min.json | province.csv
[
{
"code": "110000",
"name": "北京市",
"province": "11"
},
{
"code": "120000",
"name": "天津市",
"province": "12"
},
// ...
]
压缩数据说明 level.min.json
code: 'c'
name: 'n'
province: 'p'
city: 'y'
area: 'a'
children: 'd'
city.json | city.min.json | city.csv
[
{
"code": "130100",
"name": "石家庄市",
"province": "13",
"city": "01"
},
// ...
]
压缩数据说明 city.min.json
code: 'c'
name: 'n'
province: 'p'
city: 'y'
area.json | area.min.json | area.csv
[
{
"code": "110101",
"name": "东城区",
"province": "11",
"city": "01",
"area": "01"
},
// ...
]
压缩数据说明 city.min.json
code: 'c'
name: 'n'
province: 'p'
city: 'y'
area: 'a'
town.json | town.min.json | town.csv
[
{
"code": "110101001000",
"name": "东华门街道",
"province": "11",
"city": "01",
"area": "01",
"town": "001000"
},
// ...
]
压缩数据说明 city.min.json
code: 'c'
name: 'n'
province: 'p'
city: 'y'
area: 'a'
town: 't'
cityNotFoundTown.json | cityNotFoundTown.min.json
[
{
"code": "659010",
"name": "胡杨河市",
"province": "65",
"city": "90",
"area": "10",
"town": 0
},
// ...
]
压缩数据说明 cityNotFoundTown.min.json
code: 'c'
name: 'n'
province: 'p'
city: 'y'
area: 'a'
town: 't'