Agent skill
qgis-31-read-features-from-output-layer
Sub-skill of qgis: 3.1 Read Features from Output Layer (+2).
Install this agent skill to your Project
npx add-skill https://github.com/vamseeachanta/workspace-hub/tree/main/.claude/skills/_archive/engineering/gis/qgis/31-read-features-from-output-layer
SKILL.md
3.1 Read Features from Output Layer (+2)
3.1 Read Features from Output Layer
from qgis.core import QgsVectorLayer
layer = QgsVectorLayer("/data/output.gpkg", "result", "ogr")
features = []
for feat in layer.getFeatures():
attrs = feat.attributeMap()
geom = feat.geometry()
features.append({
"id": feat.id(),
"geom": geom.asWkt(),
"attrs": {k: v for k, v in attrs.items()}
})
3.2 Export to GeoJSON for Downstream Use
from qgis.core import QgsVectorFileWriter, QgsCoordinateTransformContext
error, msg, _, _ = QgsVectorFileWriter.writeAsVectorFormatV3(
layer,
"/data/wells.geojson",
QgsCoordinateTransformContext(),
QgsVectorFileWriter.SaveVectorOptions()
)
if error != QgsVectorFileWriter.WriterError.NoError:
raise RuntimeError(f"Export failed: {msg}")
3.3 Raster Statistics
from qgis.analysis import QgsRasterCalculator
# Read raster stats (min/max/mean depth)
from qgis.core import QgsRasterLayer
raster = QgsRasterLayer("/data/bathymetry.tif", "bathy")
provider = raster.dataProvider()
stats = provider.bandStatistics(1) # band 1
print(f"Depth range: {stats.minimumValue:.1f} to {stats.maximumValue:.1f} m")
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
gsd-complete-milestone
Archive completed milestone and prepare for next version
gsd-reapply-patches
Reapply local modifications after a GSD update
gsd-verify-work
Validate built features through conversational UAT
gsd-thread
Manage persistent context threads for cross-session work
clinical-trial-protocol
Generate clinical trial protocols for medical devices or drugs through a modular, waypoint-based architecture with research-only and full protocol modes.
single-cell-rna-qc
Performs quality control on single-cell RNA-seq data (.h5ad or .h5 files) using scverse best practices with MAD-based filtering and comprehensive visualizations.
Didn't find tool you were looking for?