Official data package for cnmaps
Project description
cnmaps-data
cnmaps-data 是 cnmaps 的官方数据包,用于承载与 cnmaps 配套的边界数据、索引数据和样例数据。
它的设计目标有三点:
- 把
cnmaps的功能代码与大体积数据解耦 - 让
cnmaps主包可以更轻、更高频地迭代 - 为第三方数据包提供可复用的协议参考
包含的数据
当前 cnmaps-data 内置三类数据集:
- 行政区边界数据
- 索引库:
cnmaps_data/data/index/administrative.db - 数据根目录:
cnmaps_data/data/datasets/administrative/
- 索引库:
- 地理边界数据
- 数据根目录:
cnmaps_data/data/datasets/geography/
- 数据根目录:
- 样例数据
- 数据根目录:
cnmaps_data/data/datasets/sample/
- 数据根目录:
与 cnmaps 的关系
cnmaps 运行时会优先发现并使用已安装的数据 provider。对官方数据包来说,cnmaps-data 会通过 Python entry point 暴露 provider,cnmaps 安装后默认会把它作为依赖一起安装。
也就是说,正常情况下用户只需要:
pip install cnmaps
就会同时得到:
cnmapscnmaps-data
数据发现机制
cnmaps 当前按以下优先级查找数据源:
- 环境变量
CNMAPS_DATA_DIR - 已安装包里注册的
cnmaps.data_providersentry point - 官方包
cnmaps_data.provider - 本地同级源码目录
cnmaps-data cnmaps内置旧数据目录(兼容过渡)
因此,第三方数据包如果想兼容 cnmaps,推荐使用 entry point 方式提供自己的 provider。
对第三方开发者
如果你希望开发自己的 cnmaps 数据包,请优先阅读:
这份文档里会说明:
- provider 需要实现什么接口
manifest.json需要有哪些字段- SQLite 索引库需要满足什么规则
- GeoJSON 文件需要满足什么格式
- 如何用检查脚本验证你的数据包
本地开发
在仓库根目录可以直接构建:
python -m build
构建结果会包含:
sdistwheel
数据检查
本仓库自带检查脚本,安装后可以直接执行:
cnmaps-data-check
或者:
python -m cnmaps_data.checker
它会检查:
manifest.json是否完整- 数据目录是否存在
- 行政区索引库 schema 是否符合要求
- 索引中声明的 GeoJSON 文件是否真实存在
- GeoJSON 的基本结构是否满足
cnmaps当前读取规则
如果要检查某个自定义目录,也可以显式传入:
python -m cnmaps_data.checker /path/to/your-data-package/cnmaps_data
如果你的命令行里还没有直接找到 cnmaps-data-check,通常是因为当前 shell 没有激活对应的 Python 环境;这种情况下直接使用 python -m cnmaps_data.checker ... 即可。
发布
本仓库已配置 GitHub Actions + PyPI Trusted Publishing。发布流程通常为:
- 更新版本号
- 推送代码
- 在 GitHub 创建 Release
- Actions 自动构建并发布到 PyPI
相关文档
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cnmaps_data-1.0.0.tar.gz.
File metadata
- Download URL: cnmaps_data-1.0.0.tar.gz
- Upload date:
- Size: 50.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81f45c06e915d511bd29bbb04b29ae5befc017e5500a4ced0301d0d26a9585d1
|
|
| MD5 |
e7dc0e803483658faef9c531cd61e373
|
|
| BLAKE2b-256 |
dd065e9de2030c42d741263d289a8dad8b41d9fc75f4ad84abf94976c8db2c6d
|
Provenance
The following attestation bundles were made for cnmaps_data-1.0.0.tar.gz:
Publisher:
pypi-publish.yml on cnmetlab/cnmaps-data
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cnmaps_data-1.0.0.tar.gz -
Subject digest:
81f45c06e915d511bd29bbb04b29ae5befc017e5500a4ced0301d0d26a9585d1 - Sigstore transparency entry: 1191972526
- Sigstore integration time:
-
Permalink:
cnmetlab/cnmaps-data@003f096448f0d840a0090b830d8af84e14a1e745 -
Branch / Tag:
refs/tags/1.0.0 - Owner: https://github.com/cnmetlab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@003f096448f0d840a0090b830d8af84e14a1e745 -
Trigger Event:
release
-
Statement type:
File details
Details for the file cnmaps_data-1.0.0-py3-none-any.whl.
File metadata
- Download URL: cnmaps_data-1.0.0-py3-none-any.whl
- Upload date:
- Size: 52.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2917cca695df10af37c107d807033c5ba1131d63e0fdf3a2ca98a4a635a88a6
|
|
| MD5 |
58392e04754cc9d3e14729fa8ba8c4ec
|
|
| BLAKE2b-256 |
b82a4c31bcfdd070ad2c7734cf5ed31074bac31c1d403146b6388146ec46b0e6
|
Provenance
The following attestation bundles were made for cnmaps_data-1.0.0-py3-none-any.whl:
Publisher:
pypi-publish.yml on cnmetlab/cnmaps-data
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cnmaps_data-1.0.0-py3-none-any.whl -
Subject digest:
d2917cca695df10af37c107d807033c5ba1131d63e0fdf3a2ca98a4a635a88a6 - Sigstore transparency entry: 1191972527
- Sigstore integration time:
-
Permalink:
cnmetlab/cnmaps-data@003f096448f0d840a0090b830d8af84e14a1e745 -
Branch / Tag:
refs/tags/1.0.0 - Owner: https://github.com/cnmetlab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@003f096448f0d840a0090b830d8af84e14a1e745 -
Trigger Event:
release
-
Statement type: