Git Product home page Git Product logo

china-regions's Introduction

china-regions

**行政区划【省、市、区县】数据(汇总、省份、地级市、区县、一级、二级、三级)(另加海外数据)

import oneLevel from '@senntyou/china-regions/lib/one-level.json';

省份:一级数据

[
  {
    "code": "110000",
    "name": "北京市"
  },
  {
    "code": "120000",
    "name": "天津市"
  },
  ...
]
import twoLevels from '@senntyou/china-regions/lib/two-levels.json';

省份 + 地级市(区县):二级数据

[
  {
    "code": "110000",
    "name": "北京市",
    "children": [
      {
        "code": "110101",
        "name": "东城区"
      },
      ...
    ]
  },
  ...
  {
    "code": "130000",
    "name": "河北省",
    "children": [
      {
        "code": "130100",
        "name": "石家庄市"
      },
      ...
    ]
  }
  ...
]

注意:

  • 对于一般的省份,第二级数据列出的是 地级市 + 直接隶属省级的区县
  • 对于直辖市、特别行政区等,第二级数据列出的是 区县 一级
import threeLevels from '@senntyou/china-regions/lib/three-levels.json';

省份 + 地级市 + 区县:三级数据

[
  {
    "code": "110000",
    "name": "北京市",
    "children": [
      {
        "code": "110101",
        "name": "东城区"
      },
      ...
    ]
  },
  ...
  {
    "code": "130000",
    "name": "河北省",
    "children": [
      {
        "code": "130100",
        "name": "石家庄市",
        "children": [
          {
            "code": "130102",
            "name": "长安区"
          },
          ...
        ]
      },
      ...
    ]
  }
  ...
]

注意:

  • 一般来说是按照 省份:地级市:区县 的顺序填入数据的
  • 对于直辖市、特别行政区等,第二级数据列出的是 区县 一级,而不存在第三级数据
  • 对于直接隶属省级的区县,第二级数据列出的是 区县 一级,而不存在第三级数据
  • 对于没有区县一级的地级市,不存在第三级数据
import threeLevelsFull from '@senntyou/china-regions/lib/three-levels-full.json';

省份 + 地级市 + 区县:三级数据(填充至完整的 3 级)

[
  {
    "code": "110000",
    "name": "北京市",
    "children": [
      {
        "code": "110101",
        "name": "东城区",
          "children": [
            {
              "code": "110101",
              "name": "东城区"
            }
          ]
      },
      ...
    ]
  },
  ...
  {
    "code": "130000",
    "name": "河北省",
    "children": [
      {
        "code": "130100",
        "name": "石家庄市",
        "children": [
          {
            "code": "130102",
            "name": "长安区"
          },
          ...
        ]
      },
      ...
    ]
  }
  ...
]

注意:

  • 一般来说是按照 省份:地级市:区县 的顺序填入数据的
  • 对于直辖市、特别行政区等,第二级数据列出的是 区县 一级,第三级使用和第二级一样的数据
  • 对于直接隶属省级的区县,第二级数据列出的是 区县 一级,第三级使用和第二级一样的数据
  • 对于没有区县一级的地级市,第三级使用和第二级一样的数据

特殊情况举例

  • 直辖市:北京、天津、上海、重庆
  • 特别行政区:香港、澳门
  • 直接隶属省级的区县:海南五指山市、琼海市等
  • 无区县的地级市:广东东莞、中山等

海外数据

国内省市区之外的海外国家一级数据

编码规则

  • 第一级:code: 990000, name: 海外
  • 第二级:code: 99xxxx, name: 美国/英国...
  • 国家编码规则:99 + 填充0 + 国际区号 ,当国际区号不足 4 位时,前面用 0 填充,补足 4 位,整个补足 6 位
  • 因为美国和加拿大国际区号一样,所以改加拿大国际区号为 2
import countryLevels from '@senntyou/china-regions/lib/country-levels.json';
[
  {
    "code": "990000",
    "name": "海外",
    "children": [
      {
        "code": "990001",
        "name": "美国"
      },
      {
        "code": "990002",
        "name": "加拿大"
      },
      ...
    ]
  }
]

china-regions's People

Contributors

deepraining avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.