Files
gis-actions/suites/test-linux/workflow.yaml
T
2026-07-21 00:57:09 +08:00

84 lines
3.4 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: 云南省界叠加分析(Linux 测试)
description: >
验证 GIS Actions 4.0 Linux 双平台(Docker + Python3)执行链路的测试套件。
【内置测试数据】
套件包内含 4 个 GeoJSON 文件,开箱即用,无需用户准备数据:
- yunnan.geojson — 云南省界(面),作为叠加分析的目标区域
- kunming.geojson — 昆明市界(面),预期在云南省内,叠加结果为"通过"
- dali.geojson — 大理州界(面),预期在云南省内,叠加结果为"通过"
- baise.geojson — 广西百色市界(面),预期不在云南省内,叠加结果为"不通过"
【执行流程】
Step 1 (GeoJSON → SHP) — 用 geopandas 将内置 GeoJSON 转为 Shapefile
Step 2 (叠加分析) — 用 geopandas 计算各城市中心点是否落在省界内
Step 3 (输出 Excel) — 用 openpyxl 将分析结果写入 Excel,含条件高亮
【预期输出】
输出的 Excel 文件包含一张"叠加分析结果"工作表,含 7 列:
城市 | 城市代码 | 城市名称 | 人口 | 在省内 | 相交 | 状态
预期结果:
- 昆明市 ✅ 在省内(通过,绿色高亮)
- 大理州 ✅ 在省内(通过,绿色高亮)
- 百色市 ❌ 不在省内(不通过,红色高亮)
Step 1 和 Step 2 依赖 gis-base 镜像(含 geopandas、openpyxl),
Step 3 使用 python3 运行时(Linux 本机 Python 环境)。
version: 1.0.2
author: Robert
platform: linux
slug: test-yunnan-overlay-linux
tags: [测试, 叠加分析, Linux, 云南省, 验证套件]
category: 测试验证
params:
output_path:
type: string
required: true
desc: >
输出 Excel 文件路径,例如 /home/user/output/result.xlsx。
文件包含"叠加分析结果"工作表,标题行有表头,数据行按通过/不通过绿色/红色高亮。
base_image: gis-base:latest
steps:
- id: geojson_to_shp
name: 内置数据 → 转为 Shapefile
description: >
从套件包内置 data/ 目录读取 4 个 GeoJSON 文件(云南省界 + 昆明/大理/百色),
用 geopandas 读取后转为 ESRI Shapefile 格式,存入共享工作目录 /tmp/output/shp/。
runtime: docker
script_id: convert
params:
output_dir: /tmp/output/shp
- id: overlay
name: 叠加分析(空间判断)
description: >
读取省界 Shapefile,读取各城市 Shapefile
使用投影坐标系(EPSG:3857)计算每个城市的几何中心点,
判断中心点是否落在省界多边形内(contains),
同时检查面面相交(intersects)作为辅助信息。
输出分析结果 JSON 到 /tmp/output/result/。
预期结果:昆明、大理在省内通过;百色不在省内不通过。
runtime: docker
script_id: overlay
depends_on: [geojson_to_shp]
params:
province_shp: /tmp/output/shp/province.shp
cities_dir: /tmp/output/shp
output_dir: /tmp/output/result
- id: export_excel
name: 输出 Excel 报表
description: >
读取叠加分析结果 JSON,用 openpyxl 生成格式化的 Excel 工作簿。
表头加粗白色字蓝色底色,数据行按"在省内"为是/否分别绿色/红色高亮。
写入用户指定的 output_path。
runtime: python3
script_id: excel
depends_on: [overlay]
params:
result_dir: /tmp/output/result
output_path: $params.output_path