SuperAPI AI 工具集

geohash-spatial-code-maps

编程与开发

查看项目

更新于 10-16 03:46

技能介绍

用途:该技能面向需要在 TypeScript 或 Rust 中实现或审查 geohash 编解码、在经纬度数据上做邻近/半径/包围盒查询、把 geohash 作为索引键存储,以及把代码库(或任意抽象图)投影为二维平面并用 geohash 前缀命名业务域的场景。

主要能力:资料给出 42 条规则,分 8 类并按优先级排列。编码与位交错(CRITICAL)含 enc-interleave-longitude-first、enc-base32-alphabet、enc-integer-morton-encode、enc-binary-chop-no-float-drift、enc-normalize-input-domain、enc-five-bit-char-boundary;精度与单元格几何(CRITICAL)含 prec-choose-from-error-radius、prec-cells-are-not-square、prec-error-is-half-cell、prec-cells-shrink-toward-poles、prec-avoid-mixed-precision;邻居与邻接(HIGH)含 nbr-canonical-lookup-tables、nbr-antimeridian-wrap、nbr-pole-handling、nbr-integer-level-neighbors、nbr-eight-neighbor-set;邻近与范围查询(HIGH)含 qry-search-cell-plus-neighbors、qry-precision-from-radius、qry-bbox-range-decomposition、qry-refine-with-haversine、qry-expand-precision-when-sparse;代码库即地图空间布局(HIGH)含 map-deterministic-projection、map-stable-coordinates、map-normalize-to-geohash-domain、map-coupling-implies-proximity、map-prefix-as-domain-region、map-precision-as-architectural-level、map-persist-coordinate-sidecar;解码与包围盒(MEDIUM-HIGH)、空间索引与存储(MEDIUM-HIGH)、导航与渲染(MEDIUM)各有对应规则。

使用方式:按需阅读单个参考文件获取详细说明、代码示例与“何时不适用”的提示;规则之间以 [[other-rule-slug]] 交叉引用。端到端构建代码地图的主线为:map-deterministic-projection → map-normalize-to-geohash-domain → 编码(第 1 类)→ map-prefix-as-domain-region → 导航(第 8 类)。参考文件包括 references/_sections.md、assets/templates/_template.md 与 metadata.json。

适用场景:调试经典 geohash 缺陷(轴交换、字母表错误、边界假阴性、高精度 off-by-one);在 SQL B-tree 或 Redis sorted sets 中存储 geohash 作为索引键;像 slippy map 一样导航 geohash 数据集(缩放对应精度、视口瓦片加载、细节层级聚合、前缀聚类、深链)。

限制说明:第 1–4、6、7 类为教科书式 geohash,来源包括 geohash 规范、davetroy/geohash-js 邻居表、Redis 与 Elasticsearch;第 5、8 类是基于既有技术(确定性图布局、Morton/Z-order 键、slippy-map 瓦片、软件制图)的新颖综合,并无权威的“geohash 你的代码库”标准库,资料中也说明了该模式何时属于过度设计。具体代码示例与实现细节需查阅各参考文件,本介绍未全部展开。