Install
openclaw skills install @ruiduobao/geoskill-raster-resampling用最近邻 / 双线性 / 三次卷积改变栅格分辨率,输出重采样后的 GeoTIFF 与统计。Resample raster resolution with nearest / bilinear / cubic convolution and emit a GeoTIFF plus statistics.
openclaw skills install @ruiduobao/geoskill-raster-resamplingImplemented purely in numpy, this skill changes the raster resolution (pixel density) using three classic resampling methods while keeping the geographic extent unchanged:
The core is implemented as an "output pixel center → input continuous coordinate" mapping, supporting arbitrary scale factors; nodata pixels are filled with the neighborhood mean during interpolation to avoid contamination. The --synthetic mode generates a 64×64 test raster with a linear slope on the left half and a classification block on the right half.
pip install numpy rasterio geopandas shapely fiona pyproj
python geoskill-raster-resampling.py --bbox 116.0 39.0 117.0 40.0 --synthetic --output-dir ./out
python geoskill-raster-resampling.py --bbox 116.0 39.0 117.0 40.0 --synthetic --method bilinear --scale 0.5 --output-dir ./half
python geoskill-raster-resampling.py --input landcover.tif --method nearest --scale 2.0 --output-dir ./up2
python geoskill-raster-resampling.py --input dem.tif --method cubic --scale 0.25 --output-dir ./dem_quarter
python geoskill-raster-resampling.py --bbox 121.0 31.0 122.0 32.0 --synthetic --method nearest --scale 0.5 --output-dir ./nn --quiet
python geoskill-raster-resampling.py --bbox 116.0 39.0 117.0 40.0 --synthetic --size 128 --method bilinear --scale 0.5 --output-dir ./big
| File | Format | Description |
|---|---|---|
resampled.tif | GeoTIFF (float32) | Resampling result, EPSG:4326 |
output-manifest.json | JSON | Run manifest (input/output shapes and value ranges) |
--input: local GeoTIFF--synthetic: locally generated test raster--synthetic mode is fully network-free.MIT
用纯 numpy 实现三种经典重采样方法改变栅格分辨率(像元密度),地理范围 保持不变:
核心按“输出像元中心 → 输入连续坐标”映射实现,支持任意缩放因子;nodata
像元在插值时用邻域均值填充以避免污染。--synthetic 模式生成左半线性
坡面、右半分类块的 64×64 测试栅格。
pip install numpy rasterio geopandas shapely fiona pyproj
python geoskill-raster-resampling.py --bbox 116.0 39.0 117.0 40.0 --synthetic --output-dir ./out
python geoskill-raster-resampling.py --bbox 116.0 39.0 117.0 40.0 --synthetic --method bilinear --scale 0.5 --output-dir ./half
python geoskill-raster-resampling.py --input landcover.tif --method nearest --scale 2.0 --output-dir ./up2
python geoskill-raster-resampling.py --input dem.tif --method cubic --scale 0.25 --output-dir ./dem_quarter
python geoskill-raster-resampling.py --bbox 121.0 31.0 122.0 32.0 --synthetic --method nearest --scale 0.5 --output-dir ./nn --quiet
python geoskill-raster-resampling.py --bbox 116.0 39.0 117.0 40.0 --synthetic --size 128 --method bilinear --scale 0.5 --output-dir ./big
| 文件 | 格式 | 说明 |
|---|---|---|
resampled.tif | GeoTIFF (float32) | 重采样结果,EPSG:4326 |
output-manifest.json | JSON | 运行清单(含输入/输出形状与值域) |
--input:本地 GeoTIFF--synthetic:本地生成测试栅格--synthetic 模式完全无网络。MIT