设计与多媒体

Geoskill: Crop Type Mapping

试用

Identify 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.

它能做什么

Identify 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.

技能文档

Prerequisites / 先准备 X 文件

⚠️ 必读 — 本 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

Crop Type Mapping

Identifies major crop types (rice, wheat, corn, etc.) from multi-temporal satellite imagery using phenological curve matching and spectral indices.

Trigger

Use when the user wants to:

  • Map crop type distribution for a region (e.g., "identify rice/wheat/corn in Henan 2024")
  • Estimate planted area by crop type with confidence intervals
  • Generate crop classification maps from Sentinel-2/Landsat time series
  • Compare crop patterns across years or regions
  • Produce agricultural intelligence reports for government or insurance

CLI Usage

# 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

Parameters

ParameterDefaultDescription
--placePlace name (e.g., 'beijing', 'shanghai')
--bboxBounding box: 'xmin,ymin,xmax,ymax' (WGS84)
--aoi-fileAOI file (GeoJSON or Shapefile)
--yearcurrentYear for analysis (2015-2030)
--start-dateStart date (YYYY-MM-DD), mutually exclusive with --year
--end-dateEnd date (YYYY-MM-DD)
--crop-schemabuilt-inCustom crop phenology schema JSON
--labelsTraining/validation labels (GeoJSON)
--methodruleClassification method: rule, rf, xgboost
--min-observations5Minimum valid observations per pixel
--field-boundariesField boundary polygons (GeoJSON)
--min-patch-area4Minimum patch area in pixels (post-processing)
--output-dir./ctm-outputOutput directory

Note: --place, --bbox, and --aoi-file are mutually exclusive.

Output

FileDescription
crop_classes.tifCrop classification raster (class codes)
crop_confidence.tifPer-pixel classification confidence (0-1)
crop_polygons.geojsonVector polygons per crop region
area_by_admin.csvArea statistics per crop class (ha, km², %)
accuracy.jsonConfusion matrix, overall accuracy, per-class F1
request.jsonInput parameters and AOI metadata
dataset-manifest.jsonData source and observation metadata
output-manifest.jsonOutput file inventory and summary
qa.jsonQuality assurance checks and status
run.logExecution log

Crop Types (Default Schema)

CropCodePeak DOYDescription
Rice1220 (Aug)Single-season late rice
Wheat2120 (Apr)Winter wheat
Corn3200 (Jul)Summer corn

Classification Methods

MethodDescription
rulePhenological curve matching using peak DOY and amplitude
rfRandom Forest (requires sklearn, falls back to rule)
xgboostXGBoost (requires sklearn, falls back to rule)

Workflow

  1. AOI parsing — resolve place/bbox/aoi-file to WGS84 bounding box
  2. Time range — parse year or custom date range
  3. Data preparation — search/acquire Sentinel-2/Landsat time series
  4. Feature extraction — compute NDVI, EVI, LSWI + phenological features
  5. Classification — rule-based or ML classification per pixel
  6. Post-processing — small patch removal, spatial smoothing
  7. Accuracy assessment — confusion matrix, per-class metrics
  8. Area statistics — pixel-counting with spherical area correction
  9. Output — GeoTIFF, GeoJSON, CSV, JSON reports

Exit Codes

CodeMeaning
0Success
2Argument error
3Dependency missing
6Data validation failure
7Processing failure

Limitations

  • Classification is remote-sensing-based estimation, not ground truth
  • Accuracy depends on cloud-free observation count and timing
  • Crop schema defaults are tuned for major grain regions (North China Plain)
  • Double-cropping regions may require custom schema
  • Results should be validated with ground truth before operational use

数据下载

本 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 
  • --bbox W,S,E,N: WGS-84 边界框 (西, 南, 东, 北)
  • --date-range START,END: 日期范围 (YYYY-MM-DD,YYYY-MM-DD)
  • --aoi-file : 替代 --bbox 的 GeoJSON 多边形
  • --cache-dir : 缓存目录 (默认 ~/.geoskill_cache)

当用户只给 --bbox + --date-range (没有 --image) 时,skill 自动下载数据。 当用户给 --image 时,走原文件路径 (向后兼容)。

相关技能

基于多时相 SAR 后向散射时序的农作物分类:逐像元时序/统计/物候特征 + 随机森林。SAR crop classification from multi-temporal backscatter time series using per-pixel phenological features and Random Forest. 合成模式生成水稻/小麦/玉米三类时序真值并评估精度,输出分类 GeoTIFF + 面积统计 + 混淆矩阵 JSON。

1 次安装

Multi-year cropland abandonment detection using NDVI time series. Identifies suspected abandoned cropland based on consecutive years without cultivation signals. Use when screening for abandoned fields, generating field verification lists, or monitoring cultivation continuity.

1 次安装

Detect and classify cropland changes from before/after NDVI rasters. Identifies suspected construction, water, forest, and bare soil changes and generates compliance investigation materials. Use when the user wants to check farmland for unauthorized changes, monitor cropland conversion, or generate compliance reports.

1 次安装

Assess crop health from NDVI time series. Use when the user wants to analyze changes, detect hazards, or generate assessment reports.

1 次安装

多年度分类编码轮作序列,识别轮作模式并统计频率。Detects crop rotation by encoding multi-year classifications into sequences, recognizing patterns and counting frequencies.

高分辨率作物识别叠加申报地块做差异检测,核查补贴合规性。Verifies subsidy compliance by overlaying high-resolution crop classification on declared parcels for difference detection.