惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
CERT Recently Published Vulnerability Notes
G
Google Developers Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
宝玉的分享
宝玉的分享
Microsoft Security Blog
Microsoft Security Blog
Jina AI
Jina AI
L
LangChain Blog
博客园_首页
有赞技术团队
有赞技术团队
The Register - Security
The Register - Security
GbyAI
GbyAI
Blog — PlanetScale
Blog — PlanetScale
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
J
Java Code Geeks
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Security Archives - TechRepublic
Security Archives - TechRepublic
量子位
雷峰网
雷峰网
Security Latest
Security Latest
博客园 - 【当耐特】
V2EX - 技术
V2EX - 技术
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东
IT之家
IT之家
爱范儿
爱范儿
S
Schneier on Security
N
News | PayPal Newsroom
H
Help Net Security
Recent Announcements
Recent Announcements
Martin Fowler
Martin Fowler
N
News and Events Feed by Topic
C
Cyber Attacks, Cyber Crime and Cyber Security
U
Unit 42
博客园 - 司徒正美
Forbes - Security
Forbes - Security
P
Proofpoint News Feed
W
WeLiveSecurity
Cisco Talos Blog
Cisco Talos Blog
小众软件
小众软件
The Cloudflare Blog
AWS News Blog
AWS News Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
P
Palo Alto Networks Blog
Google DeepMind News
Google DeepMind News
H
Heimdal Security Blog
V
Vulnerabilities – Threatpost
Microsoft Azure Blog
Microsoft Azure Blog
T
Tailwind CSS Blog
G
GRAHAM CLULEY

博客园 - 我才是银古

第16章:常见问题、排错与最佳实践 第15章:扩展生态、MCAD 与外部集成 第12章:实战案例:机械结构与 3D 打印零件 第14章:构建、测试、调试与贡献流程 第13章:OpenSCAD 源码架构与核心执行流程 第11章:预览、渲染、网格精度与性能优化 第09章:列表推导、递归与算法建模 第08章:参数化零件库与复用设计 第10章:导入导出、命令行与自动化 第06章:CSG 布尔建模方法 第07章:二维图形、拉伸、旋转与投影 第05章:基础几何、坐标系与变换 第04章:参数、变量、函数、模块与作用域 OpenSCAD 教程目录 第03章:OpenSCAD 语言基础 第02章:安装、环境配置与开发工作流 第01章:OpenSCAD 项目全景与学习路线 第02章:源码获取、编译与开发环境配置 第01章:OCCT项目全景与学习路线 第18章:二次开发实战与综合案例 第18章:综合实战案例 第17章:数据交换与协同 第16章:源码架构与二次开发 第15章:插件与自定义工作台开发 第14章:Python脚本宏与自动化 第13章:FEM仿真分析 第12章:CAM数控加工 第11章:SurfaceMesh与逆向工程 第10章:Draft二维绘图与BIM建筑 第09章:工程图TechDraw 第07章:参数化表达式与Spreadsheet 第08章:装配设计Assembly 第06章:Part工作台与几何内核 第05章:PartDesign实体特征建模 第04章:草图Sketcher约束建模 第02章:安装版本与工作环境配置 第03章:界面工作台与基础操作 第01章:项目全景与学习路线 第十二章:插件开发、研究功能与最佳实践 第十章:定时任务与自动化(Cron) 第七章:技能、记忆与自学习闭环 第八章:MCP 集成与上下文文件 第六章:工具系统与终端后端 第五章:模型供应商与配置体系 Hermes Agent 教程目录 第十一章:语音、视觉、浏览器与子代理协作 第四章:CLI/TUI 与会话管理 第十二章:学习路线、实战方案与最佳实践 第十一章:源码结构、开发调试与插件开发 第十章:自动化、远程访问、日志与排障 第九章:Control UI、节点、Canvas 与语音能力 第七章:工具、技能、插件与能力扩展 第八章:安全模型、访问控制与沙箱实践 第六章:Agent 工作区、会话与多智能体路由 第五章:多通道消息接入与聊天平台配置 第四章:配置体系、模型接入与认证管理 第三章:Gateway 架构、协议与运行机制 第二章:安装、环境准备与快速上手 第一章:OpenClaw 项目概览与核心定位 oh-my-openagent 教程目录 09-命令模型回退与配置参考 10-实战案例最佳实践与故障排除 05-工作模式-Ultrawork-Prometheus-Atlas 08-Hooks与MCP系统 06-Category与Skill系统 07-核心工具链 04-智能体全景详解 03-安装与环境配置 02-整体架构与多模型编排机制 01-项目简介与核心理念 01-项目概览与学习路线 02-安装部署与工具适配 03-Skill机制与using-superpowers 05-TDD系统化调试与完成前验证 04-需求澄清方案设计与计划编写 07-并行智能体子智能体与Git-Worktree 第六章:代码审查、反馈处理与分支收尾 08-中国特色Skills与本土团队落地 09-MCP构建工作流执行与自定义Skill 第23章:FreeCAD-Python-API Clipper2 C# 源码解读教程 第19章:PolyTree 多边形树结构 第20章:实际应用与最佳实践 第18章:Minkowski 和与差 第17章:RectClip 矩形裁剪优化 第16章:ClipperOffset 偏移类详解 第15章:填充规则详解 第14章:布尔运算执行流程 第13章:ClipperD 浮点裁剪类 第11章:OutRec 与 OutPt 输出结构 第9章:Active 活动边结构 第10章:Vertex 顶点与 LocalMinima 局部极小值 第12章:Clipper64 裁剪类详解 第7章:高精度运算与128位整数 第8章:ClipperBase 基类详解 第5章:枚举类型与常量定义 第6章:InternalClipper 内部工具类 第2章:核心数据结构 - Point64、PointD 第3章:路径与多边形表示 - Path64、PathD、Paths64、PathsD 第4章:矩形边界 - Rect64、RectD
第三章:快速上手第一个流水线
我才是银古 · 2026-06-21 · via 博客园 - 我才是银古

第三章:快速上手第一个流水线

本章通过一个完整的实战示例,带你从零到运行第一个 GeoPipeAgent 流水线,体验 AI 生成 → 框架执行的完整闭环。


3.1 准备测试数据

首先创建工作目录和测试数据:

mkdir -p my-gis-project/data
mkdir -p my-gis-project/output
cd my-gis-project

创建一个简单的测试 GeoJSON 文件 data/roads.geojson

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {"name": "主干道", "type": "primary"},
      "geometry": {
        "type": "LineString",
        "coordinates": [[116.3, 39.9], [116.4, 39.9], [116.5, 39.95]]
      }
    },
    {
      "type": "Feature",
      "properties": {"name": "次干道", "type": "secondary"},
      "geometry": {
        "type": "LineString",
        "coordinates": [[116.35, 39.85], [116.35, 39.95], [116.45, 39.95]]
      }
    }
  ]
}

3.2 编写第一个 YAML 流水线

my-gis-project/ 目录下创建流水线文件 buffer-pipeline.yaml

pipeline:
  name: "道路缓冲区分析"
  description: "对道路数据做投影转换后进行缓冲区分析,将结果保存为 GeoJSON"

  variables:
    input_path: "data/roads.geojson"
    buffer_dist: 0.01
    output_path: "output/road_buffer.geojson"

  steps:
    - id: load-roads
      use: io.read_vector
      params:
        path: "${input_path}"

    - id: buffer-roads
      use: vector.buffer
      params:
        input: "$load-roads"
        distance: "${buffer_dist}"
        cap_style: "round"

    - id: save-result
      use: io.write_vector
      params:
        input: "$buffer-roads"
        path: "${output_path}"
        format: "GeoJSON"

  outputs:
    result: "$save-result"
    feature_count: "$buffer-roads.feature_count"

流水线解读

字段 说明
pipeline.name 流水线名称,出现在报告中
pipeline.variables 可复用的变量,通过 ${变量名} 引用
pipeline.steps 步骤列表,按顺序执行
id: load-roads 步骤唯一 ID,后续步骤通过 $load-roads 引用其输出
use: io.read_vector 步骤类型,格式为 类别.动作
params 步骤参数,可使用变量替换和步骤引用
$load-roads 引用 load-roads 步骤的输出(output 字段)
$buffer-roads.feature_count 引用 buffer-roads 步骤 stats 中的 feature_count
outputs 声明流水线的最终输出,出现在 JSON 报告的 outputs

关于坐标系roads.geojson 使用 WGS84(EPSG:4326,单位为度),缓冲区距离 0.01 表示约 1 公里(纬度方向)。若需精确计量距离,应先用 vector.reproject 转换为投影坐标系(如 EPSG:3857,单位米)后再做缓冲。


3.3 执行流水线

geopipe-agent run buffer-pipeline.yaml

正常执行输出(JSON 格式):

{
  "pipeline": "道路缓冲区分析",
  "status": "success",
  "duration": 0.312,
  "steps": [
    {
      "id": "load-roads",
      "step": "io.read_vector",
      "status": "success",
      "duration": 0.089,
      "output_summary": {
        "feature_count": 2,
        "crs": "EPSG:4326",
        "geometry_types": ["LineString"],
        "columns": ["name", "type", "geometry"]
      }
    },
    {
      "id": "buffer-roads",
      "step": "vector.buffer",
      "status": "success",
      "duration": 0.124,
      "output_summary": {
        "feature_count": 2,
        "crs": "EPSG:4326",
        "geometry_types": ["Polygon"],
        "total_area": 0.00024578
      }
    },
    {
      "id": "save-result",
      "step": "io.write_vector",
      "status": "success",
      "duration": 0.098,
      "output_summary": {
        "feature_count": 2,
        "output_path": "output/road_buffer.geojson",
        "format": "GeoJSON"
      }
    }
  ],
  "outputs": {
    "result": "output/road_buffer.geojson",
    "feature_count": 2
  }
}

3.4 使用 --var 覆盖变量

通过 --var 参数在命令行覆盖流水线变量,无需修改 YAML 文件:

# 使用不同的缓冲距离
geopipe-agent run buffer-pipeline.yaml --var buffer_dist=0.02

# 同时覆盖多个变量
geopipe-agent run buffer-pipeline.yaml \
    --var input_path=data/highway.geojson \
    --var buffer_dist=0.05 \
    --var output_path=output/highway_buffer.geojson

这对批量处理多个数据文件非常方便——只需一个 YAML 文件,通过不同的 --var 参数运行多次。


3.5 流水线校验(不执行)

在正式执行之前,可以用 validate 命令检查 YAML 语法和步骤引用是否正确:

geopipe-agent validate buffer-pipeline.yaml

输出示例:

{
  "status": "valid",
  "pipeline": "道路缓冲区分析",
  "steps_count": 3,
  "steps": [
    {"id": "load-roads",    "use": "io.read_vector"},
    {"id": "buffer-roads",  "use": "vector.buffer"},
    {"id": "save-result",   "use": "io.write_vector"}
  ]
}

如果有语法错误,会看到类似这样的错误信息:

{
  "status": "invalid",
  "error": "PipelineParseError",
  "message": "Missing 'pipeline' key at the top level. Expected: pipeline:\n  name: ...\n  steps: ..."
}

3.6 带投影转换的完整示例

以下是一个更真实的示例,演示先投影转换再缓冲,确保缓冲距离单位正确:

pipeline:
  name: "道路 500 米缓冲区分析(精确距离)"
  description: "先将 WGS84 转为 Web Mercator(米制),再做 500 米缓冲"

  variables:
    input_path: "data/roads.geojson"
    buffer_dist_m: 500
    output_path: "output/road_buffer_500m.geojson"

  steps:
    - id: load-roads
      use: io.read_vector
      params:
        path: "${input_path}"

    - id: reproject-to-mercator
      use: vector.reproject
      params:
        input: "$load-roads"
        target_crs: "EPSG:3857"

    - id: buffer-500m
      use: vector.buffer
      params:
        input: "$reproject-to-mercator"
        distance: "${buffer_dist_m}"
        cap_style: "round"

    - id: reproject-back
      use: vector.reproject
      params:
        input: "$buffer-500m"
        target_crs: "EPSG:4326"

    - id: save-result
      use: io.write_vector
      params:
        input: "$reproject-back"
        path: "${output_path}"
        format: "GeoJSON"

  outputs:
    result: "$save-result"

3.7 调试模式

如果流水线执行失败或结果不符合预期,使用调试模式查看详细日志:

# 显示 DEBUG 级别日志
geopipe-agent run buffer-pipeline.yaml --log-level DEBUG

# 使用 JSON 格式日志(便于机器解析)
geopipe-agent run buffer-pipeline.yaml --json-log

3.8 查看 GIS 文件信息

在编写流水线之前,可以用 info 命令快速了解数据文件的基本信息:

geopipe-agent info data/roads.geojson

输出:

{
  "path": "data/roads.geojson",
  "format": "vector",
  "feature_count": 2,
  "crs": "EPSG:4326",
  "geometry_types": ["LineString"],
  "columns": ["name", "type", "geometry"],
  "bounds": [116.3, 39.85, 116.5, 39.95]
}

这对确定坐标系(决定缓冲距离单位)和了解属性字段非常有帮助。


3.9 快速 Cookbook 体验

GeoPipeAgent 自带 7 个即用型流水线示例(cookbook/ 目录),可以直接运行:

# 克隆仓库后
geopipe-agent run cookbook/buffer-analysis.yaml
geopipe-agent run cookbook/vector-qc.yaml
geopipe-agent run cookbook/overlay-analysis.yaml

这些示例涵盖了最常见的 GIS 工作流,是学习框架的最佳起点。


3.10 本章小结

本章完整演示了 GeoPipeAgent 的基本使用流程:

  1. 准备数据:GeoJSON、Shapefile 等格式均可直接使用
  2. 编写 YAML:在 pipeline: 下定义 variablesstepsoutputs
  3. 执行流水线geopipe-agent run <file> 一键执行,输出 JSON 报告
  4. 覆盖变量--var key=value 在运行时动态修改参数
  5. 校验流水线geopipe-agent validate <file> 在执行前检查语法
  6. 查看文件信息geopipe-agent info <file> 了解数据基本情况

下一章将深入解析 YAML 流水线格式的每一个字段和规则。


导航← 第二章:安装与环境配置第四章:YAML 流水线格式 →