/major-ai-skills:qgisfrom major-ai-skills
Automate QGIS geospatial workflows with PyQGIS, qgis_process, GDAL/OGR, and PostGIS; inspect layers and troubleshoot processing jobs.
Ships in major-ai-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
QGIS is the leading free and open-source desktop Geographic Information System (GIS), powered by a high-performance Qt/C++ core, the GDAL/OGR spatial data abstraction library, and native Python 3 (PyQGIS) bindings. QGIS provides unified access to vector, raster, point cloud (LAS/COPC), and mesh formats, features the standalone qgis_process command-line processing tool, and integrates seamlessly with PostGIS, GeoPackage, and SpatiaLite spatial databases. Claude operates as a Principal Open-Source GIS Architect and Spatial Automation Specialist, specializing in standalone PyQGIS scripting, qgis_process CLI batch workflows, PostGIS spatial SQL query optimization, and Print Layout Atlas automation.
┌─────────────────────────────────────────────────────────────┐
│ QGIS Architecture & Pipeline │
│ │
│ Presentation & Map Composer Tier │
│ ├── Multi-Threaded Map Canvas (Tile Rendering & Level of D)│
│ ├── Print Layout Composer & Atlas Multi-Page Generator │
│ └── 3D Canvas (Digital Elevation Models & Point Clouds) │
│ │
│ PyQGIS & Processing Framework (`qgis.core`) │
│ ├── `qgis_process` Headless Command-Line Runner │
│ ├── Native QGIS, GDAL, GRASS GIS, and SAGA Algorithms │
│ └── Custom Python Processing Plugins (`QgsProcessingAlgorithm)│
│ │
│ Data Abstraction & Provider Layer │
│ ├── GDAL/OGR Driver Subsystem (100+ Vector/Raster Formats) │
│ └── Spatial RDBMS Providers (PostGIS, GeoPackage, SpatiaLite)│
└─────────────────────────────────────────────────────────────┘
QgsApplication(..., False) without GUI dependencies, manage layer lifecycles, and call processing.run().qgis_process CLI Batch Execution: Construct automated bash/PowerShell batch pipelines using qgis_process run <algorithm_id> with JSON and CLI key-value arguments.ST_Intersects, ST_DWithin, ST_Union) and configure spatial indexing (GIST) for high-throughput layer rendering.QGIS_PREFIX_PATH, PYTHONPATH, PATH, GDAL_DATA) for standalone Python execution.Save this script as run_pyqgis_pipeline.py and run via the OSGeo4W Shell:
"""
Standalone PyQGIS 3.x Headless Geoprocessing Pipeline
Initializes QgsApplication, buffers vector features, and clips against boundary.
"""
import sys
import os
# 1. Configure QGIS Environment Paths (Windows OSGeo4W Defaults)
QGIS_PREFIX = r"C:\Program Files\QGIS 3.38\apps\qgis"
os.environ["QGIS_PREFIX_PATH"] = QGIS_PREFIX
os.environ["QT_QPA_PLATFORM"] = "offscreen" # Headless rendering
from qgis.core import (
QgsApplication,
QgsVectorLayer,
QgsCoordinateReferenceSystem,
QgsVectorFileWriter
)
def run_geoprocessing(roads_shapefile: str, boundary_shapefile: str, output_gpkg: str):
# Initialize Headless QgsApplication
QgsApplication.setPrefixPath(QGIS_PREFIX, True)
qgs = QgsApplication([], False)
qgs.initQgis()
# Initialize Processing Engine
from qgis.analysis import QgsNativeAlgorithms
import processing
from processing.core.Processing import Processing
Processing.initialize()
QgsApplication.processingRegistry().addProvider(QgsNativeAlgorithms())
print(f"--- [STARTING PYQGIS HEADLESS PIPELINE] ---")
# 2. Load Input Vector Layers
roads_layer = QgsVectorLayer(roads_shapefile, "Roads", "ogr")
boundary_layer = QgsVectorLayer(boundary_shapefile, "Boundary", "ogr")
if not roads_layer.isValid() or not boundary_layer.isValid():
print("Error: Failed to load one or more input shapefiles.")
qgs.exitQgis()
return
print(f"Loaded Roads Layer: {roads_layer.featureCount():,} features.")
# 3. Step 1: Buffer Roads (Distance: 50 Meters)
print("Step 1: Running native:buffer (50m)...")
buffer_result = processing.run("native:buffer", {
"INPUT": roads_layer,
"DISTANCE": 50.0,
"SEGMENTS": 8,
"END_CAP_STYLE": 0, # Round
"JOIN_STYLE": 0, # Round
"DISSOLVE": True,
"OUTPUT": "memory:buffered_roads"
})
buffered_layer = buffer_result["OUTPUT"]
# 4. Step 2: Clip Buffered Roads to Study Area Boundary
print("Step 2: Running native:clip against study boundary...")
clip_result = processing.run("native:clip", {
"INPUT": buffered_layer,
"OVERLAY": boundary_layer,
"OUTPUT": output_gpkg
})
print(f"✅ Geoprocessing complete! Saved GeoPackage to: {output_gpkg}")
# Clean Up QGIS Core
qgs.exitQgis()
if __name__ == "__main__":
if len(sys.argv) < 4:
print("Usage: python run_pyqgis_pipeline.py <roads.shp> <boundary.shp> <output.gpkg>")
sys.exit(1)
run_geoprocessing(sys.argv[1], sys.argv[2], sys.argv[3])
| Issue & Failure Signature | Root Cause Analysis | Diagnostic & Resolution Pathway |
|---|---|---|
ImportError: DLL load failed while importing _core | Standalone Python script executed without OSGeo4W library paths configured in Windows PATH. | 1. Always execute scripts inside the OSGeo4W Shell. 2. Or launch using Python wrapper: python-qgis.bat my_script.py.3. Verify QGIS_PREFIX_PATH is set. |
qgis_process Fails: Algorithm native:xyz not found | The algorithm registry was not initialized before running custom scripts. | Add Processing.initialize() and register native algorithms (QgsNativeAlgorithms()). |
PostGIS Connection Fails: SSL connection has been closed unexpectedly | High query latency caused PostgreSQL server statement_timeout on large unindexed spatial tables. | 1. In PostgreSQL, run CREATE INDEX idx_geom ON my_table USING GIST (geom);.2. In QGIS Database Manager, enable Use estimated table metadata in connection options. |
| Print Layout Atlas Export Crashes on Page 500+ | Memory leak in print composer retaining high-resolution rendered image buffers in RAM. | 1. In Atlas options, enable Single file export or batch export in ranges of 100 pages. 2. Reduce raster export DPI from 600 to 300. |
qgis_process Recipes# 1. Run Geoprocessing Algorithm via qgis_process CLI
qgis_process run native:buffer -- INPUT="C:\Data\streams.shp" DISTANCE=100 DISSOLVE=true OUTPUT="C:\Data\stream_buffer.gpkg"
# 2. List All Available Geoprocessing Algorithms
qgis_process list
# 3. Launch QGIS with Specific User Profile in Clean Mode
qgis-bin.exe --profile default --noplugins
%APPDATA%\QGIS\QGIS3\profiles\default~/.local/share/QGIS/QGIS3/profiles/defaultC:\OSGeo4W\ or C:\Program Files\QGIS 3.38\MANDATORY: Standalone Python scripts interacting with
qgis.coremust initializeQgsApplicationandProcessing.initialize(). Always execute standalone scripts throughpython-qgis.bator within the OSGeo4W Shell.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub alivirgo/major-ai-skills --plugin major-ai-skills412 skills in this plugin
/3d-slicerAutomate 3D Slicer research workflows with MRML, VTK/ITK, DICOM data, and Segment Editor. Use for software workflows, not clinical interpretation./abbreviated-git-statusInspect Git branch, staging, and working-tree changes with short or porcelain status output when a compact repository check is needed./ableton-liveAutomate Ableton Live sessions with Python MIDI Remote Scripts, Max for Live, AbletonOSC, and Link synchronization./act-as-a-personal-tutorExplain a subject step by step, assess prior knowledge, and use short exercises to check understanding before advancing.Other plugins' skills for the same job