diff --git a/suites-help/示例代码/缓冲区分析.md b/suites-help/示例代码/缓冲区分析.md new file mode 100644 index 0000000..bc393e3 --- /dev/null +++ b/suites-help/示例代码/缓冲区分析.md @@ -0,0 +1,64 @@ +# 缓冲区分析套件 + +## 功能 + +对 GeoJSON 中的地块做缓冲区分析,输出处理前后的面积对比报告。 + +## workflow.yaml + +```yaml +name: parcel-analysis +description: 地块数据批处理 — 生成→验证→缓冲区→对比→报告 +version: 2.0.0 +category: gis-processing +tags: [gis, parcel, buffer] + +params: + type: object + required: + - buffer_distance + properties: + buffer_distance: + type: number + default: 0.5 + description: 缓冲区距离(度) + +steps: + - id: main + name: 全流水线 + script_id: process + params: + buffer_distance: "${{inputs.buffer_distance}}" + +resolved_params: + - step_index: 0 + step_name: 全流水线 + params: + buffer_distance: 0.5 +``` + +## 处理流程 + +5 个阶段在单脚本中顺序执行: + +| 阶段 | 功能 | 产出 | +|------|------|------| +| Phase 1 | 生成 3 个示例地块 GeoJSON | `input_parcels.geojson` | +| Phase 2 | 验证 GeoJSON 结构、统计要素 | 校验报告 | +| Phase 3 | 缓冲区分析(顶点偏移算法) | `buffered_parcels.geojson` | +| Phase 4 | 计算每个地块处理前后的面积变化 | 面积对比 JSON | +| Phase 5 | 生成完整的对比报告 | `comparison_report.json` | + +## 输出示例 + +```json +{ + "areas": [ + {"id": "P001", "before": 0.02, "after": 0.308, "change_pct": 1439.34}, + {"id": "P002", "before": 0.018, "after": 0.327, "change_pct": 1717.11} + ], + "total_before": 0.056, + "total_after": 0.962, + "total_change_pct": 1617.91 +} +```