61 lines
1.6 KiB
Markdown
61 lines
1.6 KiB
Markdown
# CLI 参考
|
||
|
||
## 安装
|
||
|
||
`agc` 命令随 gis-actions 包一起安装。
|
||
|
||
**Linux:**
|
||
```bash
|
||
curl -sLO https://packages.mercator.cn/public/gis-actions/latest.deb
|
||
sudo dpkg -i latest.deb
|
||
```
|
||
|
||
**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`
|
||
|
||
安装后直接使用 `agc` 命令。
|
||
|
||
## 命令
|
||
|
||
### agc run
|
||
|
||
执行套件。
|
||
|
||
```bash
|
||
agc run <work_dir> --suite-id <suite-id> --input <key=value> [--input <key=value> ...]
|
||
agc run <work_dir> --package-url <url> --input <key=value>
|
||
```
|
||
|
||
| 参数 | 说明 |
|
||
|------|------|
|
||
| `work_dir` | 工作目录路径(输出写入此目录) |
|
||
| `--suite-id` | 套件 ID(从市场 API 查询) |
|
||
| `--package-url` | 直接指定脚本包下载地址(替代 --suite-id) |
|
||
| `--input` / `-i` | 输入参数,格式 `key=value`,可多次指定 |
|
||
| `--api-key` | API Key(查市场时使用,也可设环境变量 `AGENTGIS_API_KEY`) |
|
||
|
||
### 示例
|
||
|
||
```bash
|
||
# 通过套件 ID 执行
|
||
agc run /tmp/output --suite-id 2c99a1cb-84a5-42dd-9147-1c8e8f7f2941 --input buffer_distance=0.5
|
||
|
||
# 直接指定包地址
|
||
agc run /tmp/output --package-url https://git.mercator.cn/.../suite.tgz --input input_path=/data/my.shp
|
||
```
|
||
|
||
## 查询市场
|
||
|
||
`agc` 暂未内置市场查询命令,使用 curl:
|
||
|
||
```bash
|
||
# 列出所有套件
|
||
curl -s https://suites.mercator.cn/api/v1/suites | python3 -m json.tool
|
||
|
||
# 搜索套件
|
||
curl -s "https://suites.mercator.cn/api/v1/suites/search?q=缓冲区"
|
||
```
|