Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 更新日志

`cnmaps-data` 的重要变更会记录在这里。

## 1.1.0

- 新增 `cn-neighbors` 数据集,提供基于中国边界口径整理的邻国国家级边界。
- 新增 `world-countries` 数据集,补充全球其他国家与重要海外领地的国家级边界。
- 统一补充国家中文名,并提供国家名称与 `ISO3` 的对照文档。
- 增加国家名称同步脚本与数据校验能力,便于后续维护 SQLite 与 GeoJSON 记录。
- 增加 README 视觉资源与更完整的开发者文档。

## 1.0.0

- 首次发布 `cnmaps-data` 独立数据包。
- 提供 `cnmaps.data_providers` provider 接口与官方数据 provider。
- 内置中国行政区边界索引、GeoJSON 数据与示例样例数据。
- 提供基础 checker、CI 和 PyPI 发布工作流。
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<p align="center">
<img src="docs/assets/world-tech-globe-v4.png" alt="cnmaps-data globe" width="160" />
</p>

# cnmaps-data

`cnmaps-data` 是 `cnmaps` 的官方数据包,用于承载与 `cnmaps` 配套的边界数据、索引数据和样例数据。
Expand All @@ -15,11 +19,31 @@
- 行政区边界数据
- 索引库:`cnmaps_data/data/index/administrative.db`
- 数据根目录:`cnmaps_data/data/datasets/administrative/`
- 当前包含:
- `amap`:高德来源的中国行政区边界
- `cn-neighbors`:基于中国官方口径边界与世界国界数据派生的邻国国家级边界
- `world-countries`:除中国及 `cn-neighbors` 外的其他世界国家级边界
- 地理边界数据
- 数据根目录:`cnmaps_data/data/datasets/geography/`
- 样例数据
- 数据根目录:`cnmaps_data/data/datasets/sample/`

关于 `cn-neighbors`:

- 它只提供“国”一级边界,不下探到邻国的省州级行政区。
- 它的几何是基于 `cnmaps-data` 中的中国边界,结合外部世界边界源数据裁剪/派生得到。
- 这是一套带明确口径说明的派生数据,不应与国际通行的中立边界数据混淆。

关于 `world-countries`:

- 它只提供“国”一级边界。
- 当前数据库中的国家名称统一使用中文名,GeoJSON 中同时保留 `name_en` 英文名。
- 它不包含中国,也不包含已经在 `cn-neighbors` 中单独处理的邻国。
- 它也不会以国家级记录的形式单独收录台湾、香港、澳门。
- 它在写出前会统一扣除 `cnmaps-data` 当前中国边界所覆盖的几何区域,以避免与中国口径边界产生重叠。
- 中文名映射表只是维护辅助资料;最终名称仍直接写入 SQLite 和 GeoJSON 产物中。
- 除主权国家外,它现在也纳入了一批带 `iso3` 的海外领地/属地记录,例如格陵兰。

## 与 cnmaps 的关系

`cnmaps` 运行时会优先发现并使用已安装的数据 provider。对官方数据包来说,`cnmaps-data` 会通过 Python entry point 暴露 provider,`cnmaps` 安装后默认会把它作为依赖一起安装。
Expand Down Expand Up @@ -52,6 +76,7 @@ pip install cnmaps
如果你希望开发自己的 `cnmaps` 数据包,请优先阅读:

- [开发者手册](docs/developer-guide.md)
- [国家名称与 ISO3 映射表](docs/country-name-map.md)

这份文档里会说明:

Expand All @@ -69,6 +94,26 @@ pip install cnmaps
python -m build
```

如果需要重建 `cn-neighbors` 数据,可使用:

```bash
python scripts/generate_cn_neighbors.py --world-shp /path/to/world-administrative-boundaries.shp
```

如果需要生成其他世界国家级边界,可使用:

```bash
python scripts/generate_world_countries.py --world-shp /path/to/world-administrative-boundaries.shp
```

这个脚本会在输出 `world-countries` 前,先对每个国家执行一次基于中国边界的几何扣除。

如果需要把外部映射表中的中文名批量回写到 SQLite/GeoJSON,可使用:

```bash
python scripts/update_country_names.py
```

构建结果会包含:

- `sdist`
Expand Down Expand Up @@ -116,3 +161,4 @@ python -m cnmaps_data.checker /path/to/your-data-package/cnmaps_data
## 相关文档

- [开发者手册](docs/developer-guide.md)
- [更新日志](CHANGELOG.md)
2 changes: 1 addition & 1 deletion cnmaps_data/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Official data package for cnmaps."""

__version__ = "1.0.0"
__version__ = "1.1.0"

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"Feature","properties":{"iso3":"ABW","name":"阿鲁巴","name_en":"Aruba","source":"WORLD_COUNTRIES","kind":"陆地","level":"国"},"geometry":{"type":"Polygon","coordinates":[[[-69.88223999999991,12.411110000000065],[-69.9469499999999,12.43667000000005],[-70.05903999999992,12.540210000000059],[-70.05965999999995,12.627780000000087],[-70.03319999999991,12.618330000000071],[-69.93223999999992,12.528060000000039],[-69.89695999999992,12.480830000000083],[-69.89139999999992,12.47222000000005],[-69.88555999999994,12.45778000000007],[-69.8748599999999,12.415280000000052],[-69.88223999999991,12.411110000000065]]]}}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"Feature","properties":{"iso3":"AIA","name":"安圭拉","name_en":"Anguilla","source":"WORLD_COUNTRIES","kind":"陆地","level":"国"},"geometry":{"type":"Polygon","coordinates":[[[-63.16777999999994,18.16444000000007],[-63.15694999999994,18.177640000000054],[-63.141389999999944,18.194160000000068],[-63.052019999999914,18.259580000000085],[-63.022509999999954,18.268890000000056],[-62.97270999999995,18.272980000000075],[-62.98666999999995,18.235550000000046],[-62.9930599999999,18.227220000000045],[-63.02111999999994,18.21444000000008],[-63.0308399999999,18.21028000000007],[-63.074169999999924,18.192780000000084],[-63.140009999999904,18.168330000000083],[-63.153749999999945,18.165280000000052],[-63.16777999999994,18.16444000000007]]]}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"Feature","properties":{"iso3":"ALB","name":"阿尔巴尼亚","name_en":"Albania","source":"WORLD_COUNTRIES","kind":"陆地","level":"国"},"geometry":{"type":"Polygon","coordinates":[[[20.102080000000058,42.53347000000008],[20.16166000000004,42.51131000000004],[20.222500000000082,42.428330000000074],[20.239580000000046,42.36056000000008],[20.249510000000043,42.32708000000008],[20.35567000000009,42.31185000000005],[20.38694000000004,42.30416000000008],[20.45754000000005,42.27391000000006],[20.508890000000065,42.230270000000075],[20.52514000000008,42.21305000000007],[20.59528000000006,42.04361000000006],[20.62173000000007,41.95652000000007],[20.603330000000085,41.934720000000084],[20.58340000000004,41.918810000000065],[20.589640000000088,41.88219000000004],[20.568950000000086,41.87454000000008],[20.533610000000067,41.77694000000008],[20.51777000000004,41.744030000000066],[20.533890000000042,41.63472000000007],[20.46611000000007,41.55555000000004],[20.45882000000006,41.520830000000046],[20.470690000000047,41.49930000000006],[20.50861000000009,41.45972000000006],[20.561870000000056,41.40868000000006],[20.550000000000068,41.373060000000066],[20.524170000000083,41.35027000000008],[20.49885000000006,41.341800000000035],[20.502500000000055,41.304440000000056],[20.519170000000088,41.246390000000076],[20.57833000000005,41.16277000000008],[20.600610000000074,41.093180000000075],[20.66250000000008,41.08916000000005],[20.740810000000067,40.90954000000005],[20.807220000000086,40.90055000000007],[20.82111000000009,40.90888000000007],[20.83743000000004,40.92743000000007],[20.944160000000068,40.919170000000065],[20.96306000000004,40.91139000000004],[20.980540000000076,40.897210000000086],[20.983490000000074,40.855890000000045],[20.983890000000088,40.79305000000005],[21.026780000000088,40.709430000000054],[21.051460000000077,40.67444000000006],[21.053330000000074,40.62069000000008],[21.042080000000055,40.564020000000085],[20.949580000000083,40.46965000000006],[20.92014000000006,40.46360000000004],[20.833330000000046,40.46222000000006],[20.79192000000006,40.43154000000004],[20.787220000000048,40.39472000000006],[20.75861000000009,40.31194000000005],[20.736800000000073,40.307220000000086],[20.714300000000037,40.27010000000007],[20.721250000000055,40.22514000000007],[20.667080000000055,40.096250000000055],[20.621390000000076,40.08528000000007],[20.604720000000043,40.075270000000046],[20.583330000000046,40.07055000000008],[20.55583000000007,40.06638000000004],[20.479580000000055,40.06555000000009],[20.46157000000005,40.07417000000004],[20.450000000000045,40.07249000000007],[20.43028000000004,40.06305000000009],[20.315410000000043,39.99180000000007],[20.33722000000006,39.923190000000034],[20.369720000000086,39.89139000000006],[20.411320000000046,39.84465000000006],[20.413330000000087,39.82013000000006],[20.404580000000067,39.80180000000007],[20.378610000000037,39.788050000000055],[20.306130000000053,39.81212000000005],[20.294440000000066,39.80750000000006],[20.298050000000046,39.771940000000086],[20.31809000000004,39.73409000000004],[20.220000000000084,39.64736000000005],[20.196250000000077,39.64500000000004],[20.166660000000036,39.650280000000066],[20.141390000000058,39.65610000000004],[20.09701000000007,39.67597000000006],[20.02458000000007,39.696660000000065],[20.010030000000086,39.69120000000004],[19.98542000000009,39.694750000000056],[19.983610000000056,39.765270000000044],[19.987780000000043,39.86722000000009],[19.937500000000057,39.93749000000008],[19.85729000000009,40.04347000000007],[19.84111000000007,40.05138000000005],[19.825550000000078,40.05472000000009],[19.755000000000052,40.08298000000008],[19.73055000000005,40.10305000000005],[19.61666000000008,40.14916000000005],[19.503050000000087,40.19749000000007],[19.45139000000006,40.22673000000009],[19.401110000000074,40.280000000000086],[19.28979000000004,40.42145000000005],[19.318890000000067,40.43889000000007],[19.341810000000066,40.43139000000008],[19.39166000000006,40.38791000000003],[19.40292000000005,40.36999000000009],[19.40680000000009,40.35014000000007],[19.432870000000037,40.32720000000006],[19.463970000000074,40.33731000000006],[19.479440000000068,40.35486000000009],[19.487640000000056,40.43874000000005],[19.453610000000083,40.56389000000007],[19.417640000000063,40.57722000000007],[19.39333000000005,40.580970000000036],[19.337780000000066,40.61861000000005],[19.307210000000055,40.64531000000005],[19.356110000000058,40.69617000000005],[19.405000000000086,40.819720000000075],[19.413330000000087,40.86638000000005],[19.452420000000075,40.88384000000008],[19.470620000000054,40.88319000000007],[19.521660000000054,40.90985000000006],[19.52326000000005,40.93659000000008],[19.50861000000009,40.97278000000006],[19.461110000000076,41.00694000000004],[19.436210000000074,41.021060000000034],[19.450550000000078,41.06000000000006],[19.513750000000073,41.25402000000008],[19.510140000000035,41.27610000000004],[19.498610000000042,41.29389000000003],[19.475140000000067,41.30902000000009],[19.452220000000068,41.309720000000084],[19.442500000000052,41.40694000000008],[19.52000000000004,41.57000000000005],[19.56666000000007,41.585000000000036],[19.58472000000006,41.60583000000008],[19.586940000000084,41.638610000000085],[19.570830000000058,41.68527000000006],[19.58194000000009,41.69569000000007],[19.59916000000004,41.779720000000054],[19.597710000000063,41.80611000000005],[19.52476000000007,41.835240000000056],[19.479440000000068,41.852220000000045],[19.440410000000043,41.860970000000066],[19.416250000000048,41.861240000000066],[19.367770000000064,41.849000000000046],[19.343330000000037,41.91250000000008],[19.346940000000075,41.95555000000007],[19.37639000000007,42.07281000000006],[19.39910000000009,42.10409000000004],[19.378190000000075,42.12346000000008],[19.332220000000063,42.15250000000009],[19.28854000000007,42.18291000000005],[19.519720000000063,42.44861000000009],[19.608540000000062,42.54284000000007],[19.611180000000047,42.57104000000004],[19.633330000000058,42.603330000000085],[19.651530000000037,42.62319000000008],[19.71784000000008,42.660340000000076],[19.75458000000009,42.64097000000004],[19.764790000000062,42.587870000000066],[19.74681000000004,42.54500000000007],[19.76944000000009,42.50096000000008],[19.793960000000084,42.48409000000004],[19.822500000000048,42.471940000000075],[19.92736000000008,42.515550000000076],[20.056110000000047,42.562910000000045],[20.071420000000046,42.560910000000035],[20.102080000000058,42.53347000000008]]]}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"Feature","properties":{"iso3":"AND","name":"安道尔","name_en":"Andorra","source":"WORLD_COUNTRIES","kind":"陆地","level":"国"},"geometry":{"type":"Polygon","coordinates":[[[1.7188900000000444,42.50305000000009],[1.6577800000000593,42.469580000000065],[1.5375000000000796,42.436660000000074],[1.5122200000000703,42.43638000000004],[1.451530000000048,42.44625000000008],[1.4241700000000606,42.49333000000007],[1.4213900000000876,42.54583000000008],[1.434440000000052,42.576380000000086],[1.4458300000000577,42.60194000000007],[1.486530000000073,42.65041000000008],[1.559720000000084,42.65597000000008],[1.6983300000000554,42.626100000000065],[1.738610000000051,42.61638000000005],[1.781720000000064,42.56996000000004],[1.7713900000000535,42.57111000000003],[1.7418700000000626,42.560620000000085],[1.7241000000000781,42.52139000000005],[1.7236100000000647,42.50944000000004],[1.7188900000000444,42.50305000000009]]]}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"Feature","properties":{"iso3":"ANT","name":"荷属安的列斯","name_en":"Netherlands Antilles","source":"WORLD_COUNTRIES","kind":"陆地","level":"国"},"geometry":{"type":"MultiPolygon","coordinates":[[[[-68.20556999999991,12.113060000000075],[-68.22889999999995,12.039720000000045],[-68.23722999999995,12.023890000000051],[-68.25110999999993,12.020550000000071],[-68.25750999999991,12.024440000000084],[-68.27528999999993,12.051390000000083],[-68.27861999999993,12.061660000000074],[-68.28527999999994,12.102220000000045],[-68.27916999999991,12.143330000000049],[-68.2813999999999,12.15778000000006],[-68.28763999999995,12.175420000000088],[-68.30166999999994,12.199170000000038],[-68.31222999999994,12.209440000000086],[-68.32806999999991,12.215280000000064],[-68.35473999999994,12.217500000000086],[-68.36750999999992,12.216390000000047],[-68.39125999999993,12.217780000000062],[-68.4005699999999,12.222500000000082],[-68.41653999999994,12.253750000000082],[-68.40444999999994,12.292770000000075],[-68.39722999999992,12.302920000000086],[-68.38416999999993,12.307500000000061],[-68.36680999999993,12.306110000000047],[-68.19735999999995,12.22264000000007],[-68.1929199999999,12.207500000000039],[-68.20556999999991,12.113060000000075]]],[[[-68.88250999999991,12.182920000000081],[-68.86167999999992,12.17889000000008],[-68.85111999999992,12.175280000000043],[-68.83666999999991,12.168610000000058],[-68.82416999999992,12.160280000000057],[-68.75306999999992,12.065000000000055],[-68.74694999999991,12.040280000000052],[-68.79888999999991,12.040280000000052],[-68.8169499999999,12.043330000000083],[-68.82986999999991,12.048330000000078],[-68.96569999999991,12.115280000000041],[-69.06249999999994,12.188330000000065],[-69.13443999999993,12.273330000000044],[-69.15833999999995,12.311390000000074],[-69.16361999999992,12.36639000000008],[-69.14638999999994,12.383890000000065],[-69.09777999999994,12.363330000000076],[-69.07958999999994,12.350280000000055],[-69.06722999999994,12.331660000000056],[-69.0583299999999,12.31305000000009],[-69.0555599999999,12.288890000000038],[-69.0477899999999,12.269720000000063],[-69.04027999999994,12.256390000000067],[-69.02972999999992,12.242780000000039],[-68.99721999999991,12.216110000000072],[-68.98082999999991,12.204720000000066],[-68.96555999999993,12.198890000000063],[-68.91195999999991,12.181670000000054],[-68.88250999999991,12.182920000000081]]]]}}
Loading
Loading