Sub-skill of qgis: 3.1 Read Features from Output Layer (+2).
Scanned 9/9/2026
Install to Claude Code
npx -y skills add vamseeachanta/workspace-hub --skill 31-read-features-from-output-layer --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of 31 Read Features From Output Layer?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/vamseeachanta-31-read-features-from-output-layer-workspace-hub)More formats (shields.io, HTML) on the badges page.
---
name: qgis-31-read-features-from-output-layer
description: 'Sub-skill of qgis: 3.1 Read Features from Output Layer (+2).'
version: 1.0.0
category: engineering/gis
type: reference
scripts_exempt: true
---
# 3.1 Read Features from Output Layer (+2)
## 3.1 Read Features from Output Layer
```python
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
```python
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
```python
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")
```
---
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!