Skip to content
Back to skills

31 Read Features From Output Layer

ASecurity

Sub-skill of qgis: 3.1 Read Features from Output Layer (+2).

  • 17 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 9, 2026
datapythongo

Security analysis

A100/100

Scanned September 9, 2026

npx -y skills add vamseeachanta/workspace-hub --skill 31-read-features-from-output-layer --agent claude-code

Installs 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 with every re-scan.

Security grade badge for 31 Read Features From Output Layer
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vamseeachanta-31-read-features-from-output-layer/badge)](https://www.skillsdirectory.com/skills/vamseeachanta-31-read-features-from-output-layer)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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")
```

---

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.