记忆

geoskill-data-versioning

试用

对矢量数据做变更检测、版本快照与差异比较,支持 commit / diff / log 操作。Change detection, version snapshots and diff comparison for vector data with commit / diff / log operations.

它能做什么

对矢量数据做变更检测、版本快照与差异比较,支持 commit / diff / log 操作。Change detection, version snapshots and diff comparison for vector data with commit / diff / log operations.

技能文档

空间数据版本管理 | Spatial Data Versioning

Provides lightweight version management for vector data, centered on "snapshot + change detection":

  • commit: writes the current state as a GeoJSON snapshot, assigns an auto-incrementing version number (v1, v2, …) and a content hash (SHA-256, based on geometry WKT + attributes), and appends it to the version log versions.json.
  • diff: compares two versions by a stable key (default id), reporting added / removed / modified sets and field-level change details (including geometry-change flags).
  • log: lists all version entries (version tag, timestamp, feature count, hash, commit message).

Change detection performs NaN-safe comparisons of attribute values and exact WKT matching for geometries. Suitable for data-update tracking, change auditing, and incremental distribution. --synthetic mode generates two states ("baseline + changes") and demonstrates the full commit → commit → diff → log workflow offline.

Dependencies / 依赖

pip install numpy rasterio geopandas shapely fiona pyproj

Usage / 使用方法

Basic Usage

python geoskill-data-versioning.py --bbox 116.0 39.0 117.0 40.0 --synthetic --output-dir ./out

Example 1 (synthetic data, full version stream, offline)

python geoskill-data-versioning.py --bbox 116.0 39.0 117.0 40.0 --synthetic --features 30 --output-dir ./repo

Example 2: commit real data as the baseline version

python geoskill-data-versioning.py --input parcels.gpkg --message "initial import" --output-dir ./parcel_repo

Example 3: specify a comparison key field

python geoskill-data-versioning.py --input buildings.shp --key osm_id --message "2025 update" --output-dir ./bld_repo

Example 4: commit with author information

python geoskill-data-versioning.py --bbox 121.0 31.0 122.0 32.0 --synthetic --author zhangsan --message "demo" --output-dir ./repo2

Example 5: quiet commit

python geoskill-data-versioning.py --input roads.geojson --message "v1" --quiet --output-dir ./roads_repo

Output / 输出

FileFormatDescription
version_store/v{N}.geojsonGeoJSONSnapshot of each version
version_store/versions.jsonJSONVersion log (tag/hash/timestamp/feature count)
versioning_report.jsonJSONVersion list + diff results
output-manifest.jsonJSONRun manifest

Data Source / 数据源 / Source

  • --input: local vector file
  • --synthetic: locally generates two states, baseline + changes

Privacy / 隐私声明 / Privacy

  • Runs offline by default; --synthetic mode requires no network at all.
  • All processing is done locally; no user data is uploaded.

License / License

MIT



name: geoskill-data-versioning description: '对矢量数据做变更检测、版本快照与差异比较,支持 commit / diff / log 操作。Change detection, version snapshots and diff comparison for vector data with commit / diff / log operations.'

空间数据版本管理 | Spatial Data Versioning

对矢量数据做轻量级版本管理,核心是“快照 + 变更检测”:

  • commit:把当前状态写成 GeoJSON 快照,分配自增版本号(v1, v2, …) 与内容哈希(SHA-256,基于几何 WKT + 属性),追加到版本日志 versions.json。
  • diff:按稳定键(默认 id)比较两个版本,给出 added / removed / modified 集合与字段级变更明细(含几何变化标记)。
  • log:列出全部版本条目(版本 tag、时间戳、要素数、哈希、提交信息)。

变更检测对属性值做 NaN 安全比较,几何用 WKT 精确比对。适合数据更新追踪、 变更审计、增量分发。--synthetic 模式生成“基准 + 改动”两个状态,离线 演示完整的 commit → commit → diff → log 流程。

依赖

pip install numpy rasterio geopandas shapely fiona pyproj

使用方法

基本用法

python geoskill-data-versioning.py --bbox 116.0 39.0 117.0 40.0 --synthetic --output-dir ./out

示例 1(合成数据,完整版本流,离线)

python geoskill-data-versioning.py --bbox 116.0 39.0 117.0 40.0 --synthetic --features 30 --output-dir ./repo

示例 2:提交真实数据为基线版本

python geoskill-data-versioning.py --input parcels.gpkg --message "initial import" --output-dir ./parcel_repo

示例 3:指定比较键字段

python geoskill-data-versioning.py --input buildings.shp --key osm_id --message "2025 update" --output-dir ./bld_repo

示例 4:带作者信息的提交

python geoskill-data-versioning.py --bbox 121.0 31.0 122.0 32.0 --synthetic --author zhangsan --message "demo" --output-dir ./repo2

示例 5:静默提交

python geoskill-data-versioning.py --input roads.geojson --message "v1" --quiet --output-dir ./roads_repo

输出

文件格式说明
version_store/v{N}.geojsonGeoJSON各版本快照
version_store/versions.jsonJSON版本日志(tag/哈希/时间/要素数)
versioning_report.jsonJSON版本列表 + diff 结果
output-manifest.jsonJSON运行清单

数据源 / Source

  • --input:本地矢量文件
  • --synthetic:本地生成基准 + 改动两个状态

隐私声明 / Privacy

  • 默认离线运行,--synthetic 模式完全无网络。
  • 所有处理在本地完成,不上传用户数据。

License

MIT

相关技能

检查矢量几何有效性、拓扑错误、属性完整性与 CRS 一致性,输出分级质量报告。Validate geometry validity, topology, attribute completeness and CRS consistency for vector data and emit a graded quality report.

1 次安装

在 GeoPackage 中建表、导入矢量要素、创建空间索引并执行空间查询。Create tables, import vector features, build spatial indexes and run spatial queries in a GeoPackage.

扫描目录中的栅格与矢量文件,提取元数据并分类,生成可浏览的 HTML / CSV 数据目录。Scan raster and vector files in a directory, extract and classify metadata, and generate a browsable HTML / CSV data catalog.

Topology-aware cadastral parcel change detection between two epochs. Identifies new, deleted, expanded, reduced, split, and merged parcels from cadastral vector data (宗地/地块/调查图斑). Use when comparing two epochs of land parcels, auditing boundary changes, or generating cadastral change ledgers.

1 次安装

基于 GDAL / OGR 批量转换栅格与矢量格式 (GeoTIFF / Shapefile / GeoPackage / GeoJSON) 并记录日志。Batch convert raster and vector formats (GeoTIFF / Shapefile / GeoPackage / GeoJSON) via GDAL / OGR with logging.

用 Douglas-Peucker / Visvalingam 算法简化矢量几何,统计顶点减少与面积保持。Simplify vector geometries with Douglas-Peucker / Visvalingam and report vertex reduction and area retention.

1 次安装