Install
openclaw skills install @ruiduobao/geoskill-crop-type-mappingIdentify major crop types from multi-temporal optical/SAR imagery using phenological features. Produces pixel/field-level classification, area statistics, and confidence maps. Use when mapping crop distributions, estimating planted areas, or generating agricultural intelligence from remote sensing data.
openclaw skills install @ruiduobao/geoskill-crop-type-mapping⚠️ 必读 — 本 skill 不属于即用型,需要先准备特定文件才能跑。
本 skill 需要 bbox/AOI + 年份/日期范围。时序影像自动下载,但 训练标签和物候 schema 是可选的——内置 4 种作物(水稻/小麦/玉米/大豆)够用。
👉 完整教程见仓库根目录 PREREQUISITES.md 1.2 节。
先准备 X 文件:自动下载 + 内置物候 = 1 行命令可跑通。
快速试跑命令:
python crop_type_mapping.py --bbox 113.0,29.5,114.5,31.0 --year 2024 --output-dir ./ctm
Identifies major crop types (rice, wheat, corn, etc.) from multi-temporal satellite imagery using phenological curve matching and spectral indices.
Use when the user wants to:
# Basic: classify crops in a bounding box for a given year
python scripts/crop_type_mapping.py \
--bbox 113.0,29.5,114.5,31.0 \
--year 2024
# Using a place name
python scripts/crop_type_mapping.py \
--place beijing \
--year 2024
# With custom date range and output directory
python scripts/crop_type_mapping.py \
--bbox 115.0,30.0,116.0,31.0 \
--start-date 2024-04-01 \
--end-date 2024-10-31 \
--output-dir ./ctm-output
# With custom crop schema and method
python scripts/crop_type_mapping.py \
--aoi-file region.geojson \
--year 2024 \
--crop-schema references/crop_phenology.json \
--method rule \
--min-patch-area 9
| Parameter | Default | Description |
|---|---|---|
--place | — | Place name (e.g., 'beijing', 'shanghai') |
--bbox | — | Bounding box: 'xmin,ymin,xmax,ymax' (WGS84) |
--aoi-file | — | AOI file (GeoJSON or Shapefile) |
--year | current | Year for analysis (2015-2030) |
--start-date | — | Start date (YYYY-MM-DD), mutually exclusive with --year |
--end-date | — | End date (YYYY-MM-DD) |
--crop-schema | built-in | Custom crop phenology schema JSON |
--labels | — | Training/validation labels (GeoJSON) |
--method | rule | Classification method: rule, rf, xgboost |
--min-observations | 5 | Minimum valid observations per pixel |
--field-boundaries | — | Field boundary polygons (GeoJSON) |
--min-patch-area | 4 | Minimum patch area in pixels (post-processing) |
--output-dir | ./ctm-output | Output directory |
Note: --place, --bbox, and --aoi-file are mutually exclusive.
| File | Description |
|---|---|
crop_classes.tif | Crop classification raster (class codes) |
crop_confidence.tif | Per-pixel classification confidence (0-1) |
crop_polygons.geojson | Vector polygons per crop region |
area_by_admin.csv | Area statistics per crop class (ha, km², %) |
accuracy.json | Confusion matrix, overall accuracy, per-class F1 |
request.json | Input parameters and AOI metadata |
dataset-manifest.json | Data source and observation metadata |
output-manifest.json | Output file inventory and summary |
qa.json | Quality assurance checks and status |
run.log | Execution log |
| Crop | Code | Peak DOY | Description |
|---|---|---|---|
| Rice | 1 | 220 (Aug) | Single-season late rice |
| Wheat | 2 | 120 (Apr) | Winter wheat |
| Corn | 3 | 200 (Jul) | Summer corn |
| Method | Description |
|---|---|
rule | Phenological curve matching using peak DOY and amplitude |
rf | Random Forest (requires sklearn, falls back to rule) |
xgboost | XGBoost (requires sklearn, falls back to rule) |
| Code | Meaning |
|---|---|
| 0 | Success |
| 2 | Argument error |
| 3 | Dependency missing |
| 6 | Data validation failure |
| 7 | Processing failure |
本 skill 可自动从 Microsoft Planetary Computer 下载数据 (无需 API key):
python crop_type_mapping.py --bbox 116,39,117,40 --date-range 2024-06-01,2024-06-30 --output-dir <tmp>
--bbox W,S,E,N: WGS-84 边界框 (西, 南, 东, 北)--date-range START,END: 日期范围 (YYYY-MM-DD,YYYY-MM-DD)--aoi-file <path.geojson>: 替代 --bbox 的 GeoJSON 多边形--cache-dir <path>: 缓存目录 (默认 ~/.geoskill_cache)当用户只给 --bbox + --date-range (没有 --image) 时,skill 自动下载数据。
当用户给 --image 时,走原文件路径 (向后兼容)。