Cli Anything Qgis

hkuds/cli-anything/skills/cli-anything-qgis

作者 hkuds34f519533bc1無授權條款51K 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫2 週前更新

Stateful QGIS CLI for projects, writable layers, features, layouts, exports, and qgis_process operations using the real QGIS runtime.

僅含說明Data & Analytics
AI 產生的概覽

透過具狀態的命令列介面在終端機操作 QGIS,管理專案、圖層、圖徵、版面與匯出。

功能
此技能說明了一個面向真實 QGIS 執行環境的具狀態命令列介面,涵蓋 .qgs 與 .qgz 專案的建立、開啟、儲存與檢視。它也涵蓋以 GeoPackage 為後端的可寫入向量圖層、使用 WKT 幾何與具型別屬性新增圖徵、包含地圖與標註項目的列印版面,以及將版面匯出為 PDF 或影像。此外還提供通用 qgis_process 演算法的檢視與執行,以及工作階段狀態與歷史記錄。
適用情境
當你需要從終端機而非 QGIS 桌面應用程式檢視或修改 QGIS 專案時使用。它適合以指令碼或由代理驅動的地理空間工作,例如建立專案、新增圖層與圖徵、編排列印版面、匯出地圖或執行處理演算法。
執行需求
需要安裝 QGIS 並確認 qgis_process 位於 PATH 中,執行此 CLI 的 Python 環境可匯入 PyQGIS,且 Python 版本為 3.10 或更新。此技能不附帶指令碼,僅為說明文件。

cli-anything-qgis

Use this skill when you need to inspect or modify QGIS projects from the terminal through the real QGIS runtime.

Requirements

  • QGIS installed with qgis_process on PATH
  • PyQGIS importable from the Python environment running the CLI
  • Python 3.10+

Agent guidance

  • Prefer --json for all machine-driven use.
  • For one-shot commands, pass --project <path> when operating on an existing project.
  • Running cli-anything-qgis with no subcommand starts a stateful REPL.
  • Layout export is backed by real QGIS processing algorithms:
    • native:printlayouttopdf
    • native:printlayouttoimage

What this CLI covers

  • create, open, save, and inspect .qgs / .qgz projects
  • create writable GeoPackage-backed vector layers
  • add features via WKT geometry and typed key=value attributes
  • create print layouts and add map/label items
  • export layouts to PDF or image
  • inspect and run generic qgis_process algorithms
  • inspect session status and history

Command groups

project

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

layer

  • create-vector --name --geometry --crs [--field name:type ...]
  • list
  • info LAYER
  • remove LAYER

feature

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

layout

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

export

  • presets
  • pdf OUTPUT --layout LAYOUT [--dpi] [--force-vector] [--force-raster] [--georeference/--no-georeference] [--overwrite]
  • image OUTPUT --layout LAYOUT [--dpi] [--overwrite]

process

  • list
  • help ALGORITHM_ID
  • run ALGORITHM_ID [--param KEY=VALUE ...]

session

  • status
  • history [--limit N]

Examples

Create a project and add a writable layer

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

Add features and inspect them

bash
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

Create and export a layout

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

Inspect or run processing algorithms

bash
cli-anything-qgis --json process help native:buffercli-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

bash
cli-anything-qgis

Example interactive flow:

text
project new -o demo.qgz --title "Demo"layer create-vector --name places --geometry point --field name:stringfeature add --layer places --wkt "POINT(1 2)" --attr name=HQlayout create --name Mainsession statusquit

來源與署名

來源:hkuds/cli-anything位於skills/cli-anything-qgis提交34f5195

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架