Files
CM95/docs/精度规范.md
2026-09-02 09:50:12 +08:00

56 lines
1.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# CM93 母数据库精度规范 v2
## 固定常量
- CM93 raw grid: 0..65535
- CM93 Mercator semi-major axis: **6378388.0 m**
- 标准化母库:WGS84 经纬度语义 / SRID 4326
- Python 坐标计算:CPython float(C double)
- WKB X/Y:IEEE-754 8-byte double
## 禁止
- numpy.float32 作为坐标
- MySQL FLOAT 保存最终经纬度
- importer 阶段 round
- simplify
- snap
- quantize
- 自动 make_valid 后替换原 geometry
## 转换
1. 读取 raw uint16 X/Y。
2. 使用 header 的 easting/northing bounds 恢复 CM93 Mercator。
3. 若 feature 所属 `_m_sor` coverage 有 `_wgsox/_wgsoy`:在 Mercator 米坐标中减去 offset。
4. 使用 6378388.0 执行 CM93 Mercator → lon/lat。
5. WKB 写 MySQL,第二参数显式 SRID=4326。
## 数据可追踪
必须同时保存:
- source cell path
- SHA-256
- header
- raw decoded tables
- raw feature record
- raw attribute payload/value
- `_wgsox/_wgsoy`
- normalized geometry
因此标准化公式未来如需修订,不必重新取得原 CM93 光盘/目录即可重新解释数据库 raw 数据。
## 审计门槛
默认:
- parser 结构计数全部一致
- EOF 精确一致
- source SHA-256 一致
- raw chunk 总字节 = source file bytes
- source/database Feature/Attribute/Geometry/Sounding 计数一致
- WKB round-trip precision tolerance = **1e-12 degree**
`--validate-geometry` 的拓扑 validity 是额外信息,不允许通过自动修复掩盖原数据结构。