Communitygithub.com

cli-anything-qgis

有狀態的 QGIS CLI,用於管理專案、可寫入圖層、圖徵、版面配置、匯出及 qgis_process 操作,並使用真實的 QGIS 執行環境。

cli-anything-qgis 是什麼?

這是一個專為 QGIS 設計的指令列工具,讓開發者能在終端機中直接透過真實的 QGIS 執行環境來檢查或修改專案。它支援建立、開啟、儲存與檢視 .qgs/.qgz 專案,建立可寫入的 GeoPackage 向量圖層,並透過 WKT 幾何與 typed key=value 屬性新增圖徵。此外,還能建立印刷版面配置、加入地圖與標籤項目,並將版面匯出為 PDF 或圖片。此工具亦支援檢查與執行通用的 qgis_process 演算法,提供完整的流程控制。其 REPL 模式可維持會話狀態,適合逐步操作,而 --json 輸出則便於程式自動化處理。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/HKUDS/CLI-Anything/tree/main/skills/cli-anything-qgis

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

cli-anything-qgis 是做什麼的?

當您需要從終端機透過真實的 QGIS 執行環境檢查或修改 QGIS 專案時,請使用此技能。

需求

  • 已安裝 QGIS,且 qgis_process 位於 PATH 中
  • 執行 CLI 的 Python 環境必須可匯入 PyQGIS
  • Python 3.10+

Agent 指引

  • 偏好使用 --json 進行所有機器驅動的操作。
  • 對一次性指令,在操作既有專案時請加上 --project <路徑>。
  • 不帶子指令執行 cli-anything-qgis 會啟動有狀態的 REPL。
  • 版面匯出由真實的 QGIS 處理演算法支援:
    • native:printlayouttopdf
    • native:printlayouttoimage

此 CLI 涵蓋的功能

  • 建立、開啟、儲存及檢查 .qgs / .qgz 專案
  • 建立可寫入的 GeoPackage 後端向量圖層
  • 透過 WKT 幾何與 typed key=value 屬性新增圖徵
  • 建立印刷版面配置並加入地圖/標籤項目
  • 將版面匯出為 PDF 或圖片
  • 檢查並執行通用的 qgis_process 演算法
  • 檢查連線狀態與歷史記錄

指令群組

project

  • new -o/--output [--title] [--crs]
  • open 路徑
  • save [路徑]
  • info
  • set-crs CRS

layer

  • create-vector --name --geometry --crs [--field 名稱:類型 ...]
  • list
  • info 圖層
  • remove 圖層

feature

  • add --layer 圖層 --wkt WKT [--attr key=value ...]
  • list --layer 圖層 [--limit N]

layout

  • create --name [--page-size] [--orientation]
  • list
  • info 版面
  • remove 版面
  • add-map --layout 版面 --x --y --width --height [--extent xmin,ymin,xmax,ymax]
  • add-label --layout 版面 --text 文字 --x --y --width --height [--font-size N]

export

  • presets
  • pdf 輸出檔案 --layout 版面 [--dpi] [--force-vector] [--force-raster] [--georeference/--no-georeference] [--overwrite]
  • image 輸出檔案 --layout 版面 [--dpi] [--overwrite]

process

  • list
  • help 演算法ID
  • run 演算法ID [--param KEY=VALUE ...]

session

  • status
  • history [--limit N]

範例

建立專案並新增可寫入圖層

cli-anything-qgis --json project new -o demo.qgz --title "Demo" --crs EPSG:4326
cli-anything-qgis --json --project demo.qgz layer create-vector \
  --name places \
  --geometry point \
  --field name:string \
  --field score:int

新增圖徵並檢查

cli-anything-qgis --json --project demo.qgz feature add \
  --layer places \
  --wkt "POINT(1 2)" \
  --attr name=HQ \
  --attr score=5

cli-anything-qgis --json --project demo.qgz feature list --layer places --limit 10

建立並匯出版面

cli-anything-qgis --json --project demo.qgz layout create --name Main
cli-anything-qgis --json --project demo.qgz layout add-map --layout Main --x 10 --y 20 --width 180 --height 120
cli-anything-qgis --json --project demo.qgz layout add-label --layout Main --text "Demo map" --x 10 --y 8 --width 100 --height 10
cli-anything-qgis --json --project demo.qgz export pdf output.pdf --layout Main --overwrite

檢查或執行處理演算法

cli-anything-qgis --json process help native:buffer
cli-anything-qgis --json --project demo.qgz process run native:buffer \
  --param INPUT=/tmp/demo_data.gpkg|layername=places \
  --param DISTANCE=1 \
  --param SEGMENTS=8 \
  --param END_CAP_STYLE=0 \
  --param JOIN_STYLE=0 \
  --param MITER_LIMIT=2 \
  --param DISSOLVE=false \
  --param OUTPUT=/tmp/buffer.geojson

REPL

cli-anything-qgis

互動式流程範例:

project new -o demo.qgz --title "Demo"
layer create-vector --name places --geometry point --field name:string
feature add --layer places --wkt "POINT(1 2)" --attr name=HQ
layout create --name Main
session status
quit

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

cli-anything-adguardhome

>-

cli-anything-anygen

>-

cli-anything-audacity

>-

cli-anything-blender

>-

cli-anything-browser

Browser automation CLI using DOMShell MCP server. Maps Chrome

cli-anything-calibre

>-

cli-anything-ccswitch

CLI interface for CC Switch — manage AI coding tool configurations from the terminal

cli-anything-chromadb

>-

cli-anything-cloudanalyzer

Command-line interface for CloudAnalyzer — Agent-friendly harness for CloudAnalyzer, a QA platform for mapping, localization, and perception outputs. Supports 27 commands across 8 groups: point cloud evaluation, trajectory evaluation, ground segmentation QA, config-driven quality gates, baseline evolution, processing, visualization, and interactive REPL.

cli-anything-cloudcompare

Command-line interface for CloudCompare — Agent-friendly harness for CloudCompare, the open-source 3D point cloud and mesh processing software. Supports 41 commands across 9 groups: project management, session control, point cloud operations (subsample, filter, segment, analyze), mesh operations, distance computation (C2C, C2M), transformations (ICP, matrix), export (LAS/LAZ/PLY/PCD/OBJ/STL/E57), and interactive REPL.

cli-anything-comfyui

>-

cli-anything-dify-workflow

Wrapper for the Dify workflow DSL CLI. Create, inspect, validate, edit, and export Dify workflow files through a CLI-Anything harness.

cli-anything-drawio

>-

cli-anything-eez-studio

Use EEZ Studio from the command line: inspect and modify native .eez-project files, edit LVGL screens/widgets, manage SCPI commands, and invoke the real EEZ Studio backend for LVGL builds.

cli-anything-eth2-quickstart

>-

cli-anything-exa

>-

cli-anything-firefly-iii

Firefly III CLI - Personal finance management via CLI-Anything

cli-anything-freecad

Complete CLI harness for FreeCAD parametric 3D CAD modeler (258 commands). Covers ALL workbenches: Part (29 primitives + boolean + mirror + loft + sweep), Sketcher (26 cmds: geometry + constraints + editing), PartDesign (38 cmds: pad/pocket/groove/fillet/chamfer/patterns/hole/datum), Assembly (11 cmds), Mesh (16 cmds), TechDraw (15 cmds: views + dimensions + PDF/SVG), Draft (33 cmds: 2D shapes + arrays + transforms), FEM (12 cmds), CAM/CNC (10 cmds), Surface (6 cmds), Spreadsheet (7 cmds), Import (13 formats), Export (17 formats), Measure (12 cmds), Materials (21 presets). Headless FreeCAD export to STEP/IGES/STL/OBJ/DXF/PDF/glTF/3MF.

cli-anything-gimp

>-

cli-anything-godot

>-

相關技能