Skip to content

🇨🇳最全最新中国【省、市、区县、乡镇街道】json,csv,sql数据

License

Notifications You must be signed in to change notification settings

memorybx/province-city-china

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

中华人民共和国行政区划代码

Github Issues Github Forks Github Stars Github Release npm package

中华人民共和国行政区划(五级):省级、地级、县级、乡级和村级。

来自中华人民共和国民政部,用于查询中国省,市和区数据的网站。

数据更新 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。 如 湖北省 -> 424 开头,表示为 中南区

获取城市数据

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
县市区没有乡级数据 cityNotFoundTown.json - - cityNotFoundTown.json

更多 CDN 数据访问

总数据(省/地/县/乡)

data.json | data.csv | data.sql

[
  {
    "code": "110000",
    "name": "北京市",
    "province": "11",
    "city": 0,
    "area": 0,
    "town": 0
  },
  // ...
]

省/地/县/乡层级数据

level.json

[
  {
    "code": "420000",
    "name": "湖北省",
    "province": "42",
    "children": [
      {
        "code": "420100",
        "name": "武汉市",
        "province": "42",
        "city": "01",
        "children": [
          {
            "code": "420102",
            "name": "江岸区",
            "province": "42",
            "city": "01",
            "area": "02"
          },
          // ...
        ]
      }
      // ...
    ]
  }
  // ...
]

省级(省/直辖市/特别行政区)

province.json | province.csv

[
  {
    "code": "110000",
    "name": "北京市",
    "province": "11"
  },
  {
    "code": "120000",
    "name": "天津市",
    "province": "12"
  },
  // ...
]

地级(城市)

city.json | city.csv

[
  {
    "code": "130100",
    "name": "石家庄市",
    "province": "13",
    "city": "01"
  },
  // ...
]

县级(区县)

area.json | area.csv

[
  {
    "code": "110101",
    "name": "东城区",
    "province": "11",
    "city": "01",
    "area": "01"
  },
  // ...
]

乡级(乡镇/街)

town.json | town.csv

[
  {
    "code": "110101001000",
    "name": "东华门街道",
    "province": "11",
    "city": "01",
    "area": "01",
    "town": "001000"
  },
  // ...
]

县市区没有乡级数据

cityNotFoundTown.json

[
  {
    "code": "659010",
    "name": "胡杨河市",
    "province": "65",
    "city": "90",
    "area": "10",
    "town": 0
  },
  // ...
]

参考链接

License

MIT

About

🇨🇳最全最新中国【省、市、区县、乡镇街道】json,csv,sql数据

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%