Skip to content

Commit

Permalink
fixed lost data
Browse files Browse the repository at this point in the history
  • Loading branch information
adyliu committed Jan 22, 2023
1 parent 57efb1c commit e9a53f4
Show file tree
Hide file tree
Showing 12 changed files with 85 additions and 113 deletions.
Binary file removed 2009-2023.png
Binary file not shown.
Binary file added 2010-2023.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
191 changes: 81 additions & 110 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,68 @@
* 220表示村庄

![summary](summary2023.png "汇总")
![total](total2023.png "分省汇总")

# 2009 - 2023 年数据对比

| 城乡分类 | 分类描述 | 2009 | 2023 | 差距 |
|----------|------------|--------|--------|---------|
| 111 | 主城区 | 58509 | 74838 | +16329 |
| 112 | 城乡接合区 | 20389 | 30050 | +9661 |
| 121 | 镇中心区 | 46440 | 53157 | +6717 |
| 122 | 镇乡接合区 | 48447 | 54413 | +5966 |
| 123 | 特殊区域 | 6525 | 5622 | -903 |
| 210 | 乡中心区 | 23198 | 11557 | -11641 |
| 220 | 村庄 | 496599 | 389865 | -106734 |

| 代码 | 省份 |||||
|--------------|------------------|-------|--------|---------|----------|
| 110000000000 | 北京市 | 1 | 16 | 349 | 7470 |
| 120000000000 | 天津市 | 1 | 16 | 299 | 5600 |
| 130000000000 | 河北省 | 11 | 201 | 2360 | 53976 |
| 140000000000 | 山西省 | 11 | 133 | 1355 | 21875 |
| 150000000000 | 内蒙古自治区 | 12 | 117 | 1218 | 14524 |
| 210000000000 | 辽宁省 | 14 | 114 | 1400 | 16513 |
| 220000000000 | 吉林省 | 9 | 77 | 1063 | 11812 |
| 230000000000 | 黑龙江省 | 13 | 139 | 1720 | 13930 |
| 310000000000 | 上海市 | 1 | 16 | 234 | 6396 |
| 320000000000 | 江苏省 | 13 | 119 | 1494 | 21881 |
| 330000000000 | 浙江省 | 11 | 101 | 1384 | 25475 |
| 340000000000 | 安徽省 | 16 | 135 | 1682 | 18283 |
| 350000000000 | 福建省 | 9 | 93 | 1170 | 17441 |
| 360000000000 | 江西省 | 11 | 111 | 1769 | 21957 |
| 370000000000 | 山东省 | 16 | 168 | 1854 | 62079 |
| 410000000000 | 河南省 | 18 | 198 | 2585 | 52348 |
| 420000000000 | 湖北省 | 14 | 117 | 1475 | 27397 |
| 430000000000 | 湖南省 | 14 | 148 | 2008 | 29521 |
| 440000000000 | 广东省 | 21 | 141 | 1759 | 26797 |
| 450000000000 | 广西壮族自治区 | 14 | 125 | 1284 | 16647 |
| 460000000000 | 海南省 | 5 | 28 | 243 | 3290 |
| 500000000000 | 重庆市 | 2 | 38 | 1031 | 11252 |
| 510000000000 | 四川省 | 21 | 201 | 3111 | 34394 |
| 520000000000 | 贵州省 | 9 | 93 | 1510 | 17936 |
| 530000000000 | 云南省 | 16 | 137 | 1464 | 14846 |
| 540000000000 | 西藏自治区 | 7 | 80 | 703 | 5570 |
| 610000000000 | 陕西省 | 10 | 117 | 1336 | 20270 |
| 620000000000 | 甘肃省 | 14 | 99 | 1403 | 17684 |
| 630000000000 | 青海省 | 8 | 46 | 422 | 4715 |
| 640000000000 | 宁夏回族自治区 | 5 | 27 | 260 | 2909 |
| 650000000000 | 新疆维吾尔自治区 | 15 | 110 | 1405 | 14714 |
| `全国` | `664486` | `342` | `3261` | `41350` | `619502` |

# 2010 - 2023 年数据对比

| 城乡分类 | 分类描述 | 2010 | 2023 | 差距 |
|----------|------------|--------|--------|-----------|
| 111 | 主城区 | 58509 | 74838 | +16329 |
| 112 | 城乡接合区 | 20389 | 30050 | +9661 |
| 121 | 镇中心区 | 46440 | 53157 | +6717 |
| 122 | 镇乡接合区 | 48447 | 54413 | +5966 |
| 123 | 特殊区域 | 6525 | 5622 | `-903` |
| 210 | 乡中心区 | 23198 | 11557 | `-11641` |
| 220 | 村庄 | 496599 | 389865 | `-106734` |

从数据可以看出13年来,村庄从`519797` 减少 `118375``401422`,减少了 22.77%,相应的城镇数量`+37820`
大量人口从农村进入城镇,城镇化率大幅提升。

未来此趋势可能持续,大量的村庄将会荒废直至被合并至其他村庄或者取消行政村。

### 分省份来看2009-2023数据变化
### 分省份来看2010-2023数据变化

![2009-2023](2009-2023.png "分省查看变化")
![2010-2023](2010-2023.png "分省查看变化")

### 按照乡村减少比例排序

| code | name | 乡村2009 | 乡村2023 | 乡村变化 | 比例 |

| code | name | 乡村2010 | 乡村2023 | 乡村变化 | 比例 |
|--------------|------------------|----------|----------|----------|----------|
| 460000000000 | 海南省 | 5499 | 2269 | -3230 | -58.7380 |
| 430000000000 | 湖南省 | 38202 | 19242 | -18960 | -49.6309 |
Expand Down Expand Up @@ -84,7 +119,8 @@

### 按照乡村减少数量绝对值排序

| code | name | 乡村2009 | 乡村2023 | 乡村变化 | 比例 |

| code | name | 乡村2010 | 乡村2023 | 乡村变化 | 比例 |
|--------------|------------------|----------|----------|----------|----------|
| 370000000000 | 山东省 | 64691 | 40760 | -23931 | -36.9928 |
| 430000000000 | 湖南省 | 38202 | 19242 | -18960 | -49.6309 |
Expand Down Expand Up @@ -141,31 +177,31 @@

```bash
$ gzcat area_code_2023.csv.gz |wc -l
664483

$ gzcat area_code_2022.csv.gz |head
110101001001,多福巷社区居委会,5,110101001000
110101001002,银闸社区居委会,5,110101001000
110101001005,东厂社区居委会,5,110101001000
110101001006,智德社区居委会,5,110101001000
110101001007,南池子社区居委会,5,110101001000
110101001009,灯市口社区居委会,5,110101001000
110101001010,正义路社区居委会,5,110101001000
110101001013,台基厂社区居委会,5,110101001000
110101001014,韶九社区居委会,5,110101001000
110101001015,王府井社区居委会,5,110101001000
664486

$ gzcat area_code_2023.csv.gz |head
110000000000,北京市,1,0,\N
110100000000,市辖区,2,110000000000,\N
110101000000,东城区,3,110100000000,\N
110101001000,东华门街道,4,110101000000,\N
110101001001,多福巷社区居委会,5,110101001000,111
110101001002,银闸社区居委会,5,110101001000,111
110101001005,东厂社区居委会,5,110101001000,111
110101001006,智德社区居委会,5,110101001000,111
110101001007,南池子社区居委会,5,110101001000,111
110101001009,灯市口社区居委会,5,110101001000,111
```

## SQL 格式

> $ gzcat area_code_2023.sql.gz |head -n 34
> $ gzcat area_code_2023.sql.gz |head -n 36
```sql
-- MariaDB dump 10.18 Distrib 10.5.8-MariaDB, for Linux ()
-- MariaDB dump 10.19 Distrib 10.5.18-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: localhost Database: china_area
-- Host: 127.0.0.1 Database: china_area
-- ------------------------------------------------------
-- Server version 10.5.8-MariaDB-log
-- Server version 8.0.32

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
Expand All @@ -186,92 +222,27 @@ DROP TABLE IF EXISTS `area_code_2023`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `area_code_2023` (
`code` bigint(12) unsigned NOT NULL COMMENT '区划代码',
`code` bigint unsigned NOT NULL COMMENT '区划代码',
`name` varchar(128) NOT NULL DEFAULT '' COMMENT '名称',
`level` tinyint(1) NOT NULL COMMENT '级别1-5,省市县镇村',
`pcode` bigint(12) DEFAULT NULL COMMENT '父级区划代码',
`pcode` bigint DEFAULT NULL COMMENT '父级区划代码',
`category` int DEFAULT NULL COMMENT '城乡分类',
PRIMARY KEY (`code`),
KEY `name` (`name`),
KEY `level` (`level`),
KEY `pcode` (`pcode`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

```

> 创建视图 area_index_2023
```sql
CREATE VIEW area_index_2023 AS
SELECT a.code,e.name AS province,d.name AS city ,c.name AS county,b.name AS town,a.name AS villagetr
FROM area_code_2023 a
JOIN area_code_2023 b ON a.level=5 AND b.level=4 AND a.pcode=b.code
JOIN area_code_2023 c ON b.pcode=c.code
JOIN area_code_2023 d ON c.pcode=d.code
JOIN area_code_2023 e ON d.pcode=e.code
ORDER BY a.code
```

查询几条记录

> SELECT * FROM area_index_2023 LIMIT 10
```text
+--------------+-----------+-----------+-----------+-----------------+--------------------------+
| code | province | city | county | town | villagetr |
+--------------+-----------+-----------+-----------+-----------------+--------------------------+
| 110101001001 | 北京市 | 市辖区 | 东城区 | 东华门街道 | 多福巷社区居委会 |
| 110101001002 | 北京市 | 市辖区 | 东城区 | 东华门街道 | 银闸社区居委会 |
| 110101001005 | 北京市 | 市辖区 | 东城区 | 东华门街道 | 东厂社区居委会 |
| 110101001006 | 北京市 | 市辖区 | 东城区 | 东华门街道 | 智德社区居委会 |
| 110101001007 | 北京市 | 市辖区 | 东城区 | 东华门街道 | 南池子社区居委会 |
| 110101001009 | 北京市 | 市辖区 | 东城区 | 东华门街道 | 灯市口社区居委会 |
| 110101001010 | 北京市 | 市辖区 | 东城区 | 东华门街道 | 正义路社区居委会 |
| 110101001013 | 北京市 | 市辖区 | 东城区 | 东华门街道 | 台基厂社区居委会 |
| 110101001014 | 北京市 | 市辖区 | 东城区 | 东华门街道 | 韶九社区居委会 |
| 110101001015 | 北京市 | 市辖区 | 东城区 | 东华门街道 | 王府井社区居委会 |
+--------------+-----------+-----------+-----------+-----------------+--------------------------+
```
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

## 三级区划的JSON格式

JSON格式,适合web端js加载。


```json
[
{
"code": 110000000000,
"name": "北京市",
"level": 1,
"pcode": 0,
"children": [
{
"code": 110100000000,
"name": "市辖区",
"level": 2,
"pcode": 110000000000,
"children": [
{
"code": 110101000000,
"name": "东城区",
"level": 3,
"pcode": 110100000000
},
{
"code": 110102000000,
"name": "西城区",
"level": 3,
"pcode": 110100000000
}
]
}
]
}
]
```

## 文件列表

- [area_code_2023.csv.gz](area_code_2023.csv.gz)
- [area_code_2023.csv.gz](area_code_2023.csv.gz)
- MD5 (area_code_2023.csv.gz) = bd59582978111beeb70e9fb9a99d5630
- [area_code_2023.sql.gz](area_code_2023.sql.gz)
- [area_code_2023.json](area_code_2023.json)
- MD5 (area_code_2023.sql.gz) = 7a6c2499c430343ac8d1e19866d2e1d1
- [area_code_2010.csv.gz](area_code_2010.csv.gz)
- MD5 (area_code_2010.csv.gz) = caea79525da13ae341c176c2af0a12f5
- [area_code_2010.sql.gz](area_code_2010.sql.gz)
- MD5 (area_code_2010.sql.gz) = c76bf44ca08f19cac6d0592375395f96
Binary file added area_code_2010.csv.gz
Binary file not shown.
1 change: 1 addition & 0 deletions area_code_2010.csv.gz.md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MD5 (area_code_2010.csv.gz) = caea79525da13ae341c176c2af0a12f5
Binary file added area_code_2010.sql.gz
Binary file not shown.
1 change: 1 addition & 0 deletions area_code_2010.sql.gz.md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MD5 (area_code_2010.sql.gz) = c76bf44ca08f19cac6d0592375395f96
Binary file modified area_code_2023.csv.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion area_code_2023.csv.gz.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MD5 (area_code_2023.csv.gz) = c6c441e8e1e58074dd74dbe46de3a0bd
MD5 (area_code_2023.csv.gz) = bd59582978111beeb70e9fb9a99d5630
1 change: 0 additions & 1 deletion area_code_2023.json

This file was deleted.

Binary file modified area_code_2023.sql.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion area_code_2023.sql.gz.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MD5 (area_code_2023.sql.gz) = 1976b20a4087b91ce8b43a62f3672edc
MD5 (area_code_2023.sql.gz) = 7a6c2499c430343ac8d1e19866d2e1d1

0 comments on commit e9a53f4

Please sign in to comment.