pyqgis

pyqgis is a skill for Claude Code, Codex from znlgis/opengis-skills. It costs 101 tokens per session (4,791 once invoked), scanned A, original, MIT.

A Python interface to QGIS, an open-source desktop application for creating and analysing maps. It lets Python code control QGIS, its map layers, processing tools, and exports.

In plain words
What is it for?
Use it to build QGIS plugins, run spatial-analysis algorithms, compose and export maps, or operate on QGIS projects from Python scripts.
Why use it?
It removes repetitive manual work in QGIS and provides a way to automate map and spatial-data tasks.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to build QGIS plugins, run spatial-analysis algorithms, compose and export maps, or operate on QGIS projects from Python scripts.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/znlgis/opengis-skills/pyqgis
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add znlgis/opengis-skills --skill pyqgis
Clone the repo
git clone --depth 1 https://github.com/znlgis/opengis-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pyqgis

README.md
[![agentmods](https://agentmods.dev/badge/skills/znlgis/opengis-skills/pyqgis/github.svg)](https://agentmods.dev/skills/znlgis/opengis-skills/pyqgis)
Your own site
<a href="https://agentmods.dev/skills/znlgis/opengis-skills/pyqgis"><img src="https://agentmods.dev/badge/skills/znlgis/opengis-skills/pyqgis/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pyqgis

Your own site · 80×15
<a href="https://agentmods.dev/skills/znlgis/opengis-skills/pyqgis"><img src="https://agentmods.dev/badge/skills/znlgis/opengis-skills/pyqgis.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 101 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,791 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00101 $0.04791
Opus 5.5 $0.00040 $0.01916
Sonnet 5.5 $0.00020 $0.00958
Haiku 4.5 $0.00010 $0.00479

Measured today against content hash 2adec0e91e13, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

pyqgis scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

gis/pyqgis/SKILL.md · 434 lines

How it starts

The opening of the file, as written. The whole thing — 434 lines — stays where its author put it; the contents beside it link to each section on GitHub.

项目地址: https://github.com/qgis/QGIS

开发者手册: https://docs.qgis.org/4.2/en/docs/pyqgis_developer_cookbook/

Python API 参考: https://qgis.org/pyqgis/4.2/

最新版本: QGIS 4.2.3(截至 2026-10,下载页);LTR 3.44.15

许可证: GPL-2.0+

概述

PyQGIS 是 QGIS 桌面 GIS 软件的 Python 绑定层,对应 QGIS 源码中 python/ 目录下的绑定代码。它将 QGIS 核心 C++ 类库完整暴露给 Python,使得开发者可以:

  • 在 QGIS Python 控制台中交互式操作
  • 编写 独立 Python 脚本(无需启动 QGIS 桌面)
  • 开发 QGIS 插件扩展桌面功能
  • 调用 Processing 框架执行 100+ 种空间分析算法
  • 进行 地图渲染与导出(PNG / PDF / SVG)

PyQGIS 主要包含以下模块:

模块 说明
qgis.core 核心类——图层、要素、几何、坐标系、项目、Processing 等
qgis.gui GUI 组件——地图画布、地图工具、符号选择器等
qgis.analysis 空间分析——插值、网络分析、栅格计算等
processing Processing 算法调用入口(独立 Python 模块,processing.run();非 qgis.processing)
qgis.server QGIS Server Python 插件接口
qgis._3d 3D 地图视图相关类
qgis.PyQt PyQt5/PyQt6 兼容层

环境准备

前置条件

  • 安装 QGIS 4.2+(当前稳定版)或 3.44 LTR(长期支持版)(查看 QGIS LTR/最新版)
  • 使用 QGIS 发行包自带的 Python 解释器(4.2 的 Windows 安装目录为 apps/Python312),不要用系统 Python 直接 pip install qgis

探测发行包实际使用的解释器版本(在任何 QGIS Python 环境里):

python -c "import sys; print(sys.version)"

在 QGIS Python 控制台中使用

打开 QGIS 桌面 → 菜单「Plugins → Python Console」,即可直接使用 PyQGIS:

# QGIS 控制台中无需初始化,直接使用
layer = iface.activeLayer()
print(layer.name(), layer.featureCount())

独立脚本(Standalone Script)

在 QGIS 外部运行 Python 脚本时,需要先初始化 QGIS 应用:

import sys
from qgis.core import QgsApplication

# 初始化 QGIS(False 表示不使用 GUI)
qgs = QgsApplication([], False)
qgs.setPrefixPath("/usr", True)  # Linux; Windows 示例:"C:/OSGeo4W/apps/qgis"
qgs.initQgis()

# ===== 在此处编写 PyQGIS 代码 =====

# 退出
qgs.exitQgis()

独立脚本中使用 Processing

import sys
from qgis.core import QgsApplication
import processing
from processing.core.Processing import Processing

qgs = QgsApplication([], False)
qgs.setPrefixPath("/usr", True)
qgs.initQgis()

# 初始化 Processing 框架
Processing.initialize()

# 现在可以使用 processing.run()
result = processing.run("native:buffer", {
    'INPUT': '/data/points.shp',
    'DISTANCE': 100,
    'OUTPUT': '/data/buffered.shp'
})

qgs.exitQgis()

Read the full file on GitHub · 434 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today Changed · +8 lines · +6 tokens per session 2adec0e91e13
  2. 7d ago Changed · -34 lines · +51 tokens per session 4af5661e2251
  3. 12d ago Changed 1d24d2072aea
  4. 13d ago Changed · +49 lines e89a131b55d4
  5. 1mo ago Changed f3ae9045d7ef
  6. 1mo ago Changed ee1b4010fb51
  7. 1mo ago First seen · 411 lines · 44 tokens per session scan A 86d9da392b02

Subscribe to this mod's changes

pyqgis is a skill published in the GitHub repository znlgis/opengis-skills (75 stars, last pushed today), licensed MIT. It adds 101 tokens to every session and 4,791 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

commands-create-slash-command

Create or edit reusable Agent Zero /commands with YAML and text/Python templates.

agent0ai/agent-zero · 22 tokens

plugin-system

Generic plugin system for Python applications. Auto-discovery, validation, fault tolerance. Zero dependencies (Python stdlib only).

ellmos-ai/skills · 27 tokens

domain-driven-design

DDD tactical patterns for complex business modeling including entities, value objects, aggregates, domain services, repositories, specifications, and bounded contexts. Python dataclass implementations with TypeScript alternatives. Use when building rich domain models, enforcing invariants, or separating domain logic…

martineserios/thebrana · 57 tokens

qgis-syntax-pyqgis-api

Use when writing PyQGIS scripts, accessing features, editing layers, or performing geometry operations. Prevents edit session violations, threading crashes, and inefficient feature iteration. Covers 4 scripting contexts, feature CRUD, geometry operations, spatial indexing, background tasks, and basic symbology.…

Impertio-Studio/QGIS-Claude-Skill-Package · 113 tokens

pn-python-scaffolding

Scaffolds new Python API projects (FastAPI, Flask, Django) or routes. Use when adding a new route/module; covers project layout, env/secrets, validation, error handling, and idiomatic Python patterns.

perniemann/pnCore · 51 tokens

pennylane

Builds and differentiates PennyLane quantum circuits, hybrid PyTorch or JAX models, molecular VQE and QAOA workflows. Use for variational quantum algorithms, quantum machine learning, simulator validation, and moving validated circuits to provider plugins. For hardware-specific compilation use qiskit or cirq; for…

K-Dense-AI/scientific-agent-skills · 74 tokens