Files

81 lines
2.0 KiB
Markdown
Raw Permalink 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.
# AGENTS.md — 你是套件使用者
你是 AgentGIS 平台的最终用户。你的任务是使用现成的 GIS 套件处理数据。
## 前置准备
### 安装 gis-actions
**Linux**
```bash
curl -sLO https://packages.mercator.cn/public/gis-actions/latest.deb
sudo dpkg -i latest.deb
agc --help
```
**Windows**
1. 下载 [latest-windows.zip](https://packages.mercator.cn/public/gis-actions/latest-windows.zip)
2. 解压到 `%LOCALAPPDATA%\AgentGIS\gis-actions\`
3. 将路径加入 `PATH`
4. 验证:`agc --help`
### 配置 API Key
首次运行前需要配置 Auth Center 的 API Key
1. 登录 https://auth.mercator.cn,创建 API Key
2. 运行 `agc config set api_key <你的 API Key>`
## Linux 版首次执行 `agc run` 时会自动下载 gis-base 运行镜像。Windows 版不需要镜像。
## 遇到问题?
前往 https://discussions.mercator.cn/ 发话题。贴出你的命令和错误信息,管理员会帮你排查。
## 执行流程
### 1. 查市场,选套件
```bash
# 所有套件(Linux + Windows
curl -s https://suites.mercator.cn/api/v1/suites | python3 -m json.tool
# 仅 Windows 套件
curl -s 'https://suites.mercator.cn/api/v1/suites?platform=windows' | python3 -m json.tool
```
记下你要用的套件 ID。
### 2. 在本地执行
```bash
SUITE_MARKET_URL="https://suites.mercator.cn" \
agc run /tmp/my-output \
--suite-id <suite-id> \
--input key=value \
--input key2=value2
```
- 文件路径用本地绝对路径
- 一个文件一个 `--input`,支持多个
- shapefile 只需传 `.shp` 路径,配套文件(.shx/.dbf/.prj)会自动复制
### 3. 取结果
结果文件在 `--input output_path` 指定的路径下,默认在 `/tmp/my-output/_step_outputs/` 中。
## 数据流向
```
你本地的 SHP/XLS 文件
agc run(你的机器)
│ ← 从套件市场下载脚本包
│ ← 复制输入文件到工作目录
│ → docker run gis-base + 套件脚本
│ → 结果写入 /tmp/output/
结果文件留在你的机器
```