Skip to content

export

qgis-cli export

Reads features from one layer of a project and writes them to a geospatial data format. Filtering, bounding boxes, and column selection happen in the provider, so only the rows you ask for are read.

Synopsis

Terminal window
qgis-cli export <PROJECT> --layer <NAME> [OPTIONS]

Options

OptionDefaultDescription
--layer <NAME>—Layer to export, as listed by qgis-cli info.
-o, --output <FILE>—Output file. The format follows the extension.
--filter <EXPR>—QGIS expression filter, e.g. "height" > 50.
--bbox <MINX,MINY,MAXX,MAXY>—Restrict to a bounding box in the layer CRS.
--select <A,B,C>all fieldsFields to include. geometry selects the geometry column.
--crs <AUTH:CODE>layer CRSReproject the output.
--limit <N>unlimitedStop after N features.

Output formats

ExtensionFormat
.geojsonGeoJSON FeatureCollection
.geojsonlGeoJSON Lines (one feature per line)
.gpkgGeoPackage
.fgbFlatGeobuf
.csvCSV with WKT geometry

Examples

Terminal window
# Whole layer to GeoJSON
qgis-cli export map.qgs --layer buildings -o buildings.geojson
# Only tall buildings
qgis-cli export map.qgs --layer buildings --filter "\"height\" > 50" -o tall.geojson
# Only what intersects an area, two columns plus geometry
qgis-cli export map.qgs --layer buildings \
--bbox 14.0,50.0,15.0,51.0 \
--select name,height,geometry \
-o buildings.geojson
# Reprojected GeoPackage
qgis-cli export map.qgs --layer buildings --crs EPSG:3857 -o buildings.gpkg
# Stream the first thousand features as GeoJSON Lines
qgis-cli export map.qgs --layer buildings --limit 1000 -o buildings.geojsonl

See also