Install
openclaw skills install @ruiduobao/geoskill-map-algebra-calculatorEvaluate band math expressions like NDVI on rasters with a safe expression parser
openclaw skills install @ruiduobao/geoskill-map-algebra-calculatorPerform map algebra on multiband rasters using a safe expression evaluator based on Python ast, supporting band references b1..bN, arithmetic, powers and common math functions, with built-in presets for NDVI/NDWI/SAVI/EVI and other indices.
Expressions are validated against a whitelist: attribute access, imports and non-whitelisted calls are rejected; division by zero is automatically set to 0, so the results contain no inf/nan.
ast.parse(mode='eval') → whitelisted recursive evaluation (numbers/bands/pi,e/whitelisted functions/+-*/% **) → division-by-zero set to 0 → float32 raster.
pip install numpy rasterio scipy matplotlib geopandas shapely pillow
python geoskill-map-algebra-calculator.py --bbox 116.0 39.0 117.0 40.0 --synthetic --output-dir ./out
python geoskill-map-algebra-calculator.py --input scene.tif --expr "(b4-b3)/(b4+b3)"
python geoskill-map-algebra-calculator.py --input scene.tif --preset ndwi --green 2 --nir 4
python geoskill-map-algebra-calculator.py --input scene.tif --expr "b2/b1 * 100"
python geoskill-map-algebra-calculator.py --bbox 116 39 117 40 --synthetic --preset ndvi
| File | Format | Description |
|---|---|---|
result.tif | GeoTIFF | Result raster of the operation (main/verifiable deliverable) |
expression_meta.json | JSON | Expression and result statistics |
Each run also produces output-manifest.json (run manifest).
Local GeoTIFF / vector files; --synthetic mode generates physically consistent simulated data, fully offline.
--synthetic mode requires no network at all.MIT
对多波段栅格做地图代数运算,用基于 Python ast 的安全表达式求值器支持波段引用 b1..bN、四则运算、幂与常用数学函数,内置 NDVI/NDWI/SAVI/EVI 等预设指数。
表达式经白名单校验,拒绝属性访问、导入与非白名单调用;除零自动置 0,结果无 inf/nan。
ast.parse(mode='eval') → 白名单递归求值(数字/波段/pi,e/白名单函数/+-*/% **) → 除零置 0 → float32 栅格。
pip install numpy rasterio scipy matplotlib geopandas shapely pillow
python geoskill-map-algebra-calculator.py --bbox 116.0 39.0 117.0 40.0 --synthetic --output-dir ./out
python geoskill-map-algebra-calculator.py --input scene.tif --expr "(b4-b3)/(b4+b3)"
python geoskill-map-algebra-calculator.py --input scene.tif --preset ndwi --green 2 --nir 4
python geoskill-map-algebra-calculator.py --input scene.tif --expr "b2/b1 * 100"
python geoskill-map-algebra-calculator.py --bbox 116 39 117 40 --synthetic --preset ndvi
| 文件 | 格式 | 说明 |
|---|---|---|
result.tif | GeoTIFF | 运算结果栅格(主产物/可验证产物) |
expression_meta.json | JSON | 表达式与结果统计 |
每次运行还会产出 output-manifest.json(运行清单)。
本地 GeoTIFF / 矢量文件;--synthetic 模式生成物理一致的模拟数据,完全离线。
--synthetic 模式完全无网络。MIT