Class: QgsPointCloudLayerExporter

class qgis.core.QgsPointCloudLayerExporter

Bases: sip.wrapper

Handles exporting point cloud layers to memory layers, OGR supported files and PDAL supported files.

New in version 3.28.

QgsPointCloudLayerExporter(layer: QgsPointCloudLayer) Constructor for QgsPointCloudLayerExporter, associated with the specified layer.

Note

The layer is safe to be deleted once it’s used in the constructor.

Enums

ExportFormat

Bases: enum.IntEnum

Methods

attributes

Gets the list of point cloud attributes that will be exported.

crs

Gets the crs for the exported file.

doExport

Performs the actual exporting operation.

feedback

Gets a pointer to the QgsFeedback object used for cancellation / progress reporting, or None if not set.

fileName

Gets the filename for the new layer.

filterExtent

Gets the filter extent for points to be exported.

format

Returns the format for the exported file or layer.

lastError

Gets the last error that occurred during the exporting operation.

layerName

Gets the name for the new layer.

pointsLimit

Gets the maximum number of points to be exported.

prepareExport

Creates the QgsVectorLayer for exporting to a memory layer, if necessary.

setActionOnExistingFile

Sets whether an existing output vector file should be overwritten on appended to.

setAllAttributes

Sets that all attributes will be exported.

setAttributes

Sets the list of point cloud attributes that will be exported.

setCrs

Sets the crs for the exported file, and the transform context that will be used for reprojection if different from the point cloud layer's CRS.

setFeedback

Sets a QgsFeedback object to allow cancellation / progress reporting.

setFileName

Sets the filename for the new layer.

setFilterExtent

Sets a filter extent for points to be exported in the target CRS Points that fall outside the extent will be skipped.

setFilterGeometry

Sets a spatial filter for points to be exported based on geom in the point cloud's CRS.

setFormat

Sets the format for the exported file.

setLayerName

Sets the name for the new layer.

setNoAttributes

Sets that no attributes will be exported.

setPointsLimit

Sets the maximum number of points to be exported.

setZRange

Sets an inclusive range for Z values to be exported.

takeExportedLayer

Gets a pointer to the exported layer.

zRange

Gets the inclusive range for Z values to be exported.

class ExportFormat(value)

Bases: enum.IntEnum

Supported export formats for point clouds

  • Memory: Memory layer

  • Las: LAS/LAZ point cloud

  • Gpkg: Geopackage

  • Shp: ESRI ShapeFile

  • Dxf: AutoCAD dxf

  • Csv: Comma separated values

Csv = 5
Dxf = 4
Gpkg = 2
Las = 1
Memory = 0
Shp = 3
attributes(self) List[str]

Gets the list of point cloud attributes that will be exported.

Return type:

List[str]

crs(self) QgsCoordinateReferenceSystem

Gets the crs for the exported file.

Return type:

QgsCoordinateReferenceSystem

doExport(self)

Performs the actual exporting operation.

feedback(self) QgsFeedback

Gets a pointer to the QgsFeedback object used for cancellation / progress reporting, or None if not set.

Return type:

QgsFeedback

fileName(self) str

Gets the filename for the new layer.

Return type:

str

filterExtent(self) QgsRectangle

Gets the filter extent for points to be exported.

Return type:

QgsRectangle

format(self) QgsPointCloudLayerExporter.ExportFormat

Returns the format for the exported file or layer.

Return type:

QgsPointCloudLayerExporter.ExportFormat

lastError(self) str

Gets the last error that occurred during the exporting operation. If no error occurred an empty string is returned.

Return type:

str

layerName(self) str

Gets the name for the new layer.

Return type:

str

pointsLimit(self) int

Gets the maximum number of points to be exported. 0 means no limit.

Return type:

int

prepareExport(self)

Creates the QgsVectorLayer for exporting to a memory layer, if necessary. This method allows the exported memory layer to be created in the main thread. If not explicitly called, this method will be implicitly called by doExport().

setActionOnExistingFile(self, action: QgsVectorFileWriter.ActionOnExistingFile)

Sets whether an existing output vector file should be overwritten on appended to.

Note

Only applies to vector formats

Parameters:

action (QgsVectorFileWriter.ActionOnExistingFile) –

setAllAttributes(self)

Sets that all attributes will be exported.

setAttributes(self, attributes: Iterable[str])

Sets the list of point cloud attributes that will be exported. If never called, all attributes will be exported.

Note

This has no effect when exporting to LAS/LAZ format.

Parameters:

attributes (Iterable[str]) –

setCrs(self, crs: QgsCoordinateReferenceSystem, context: QgsCoordinateTransformContext = QgsCoordinateTransformContext())

Sets the crs for the exported file, and the transform context that will be used for reprojection if different from the point cloud layer’s CRS.

Parameters:
setFeedback(self, feedback: QgsFeedback)

Sets a QgsFeedback object to allow cancellation / progress reporting.

Note

The feedback object must exist for the lifetime of the exporter.

Parameters:

feedback (QgsFeedback) –

setFileName(self, filename: str)

Sets the filename for the new layer.

Parameters:

filename (str) –

setFilterExtent(self, extent: QgsRectangle)

Sets a filter extent for points to be exported in the target CRS Points that fall outside the extent will be skipped.

See also

setCrs()

Parameters:

extent (QgsRectangle) –

setFilterGeometry(self, geometry: QgsAbstractGeometry)

Sets a spatial filter for points to be exported based on geom in the point cloud’s CRS. Points that do not intersect geometry will be skipped.

setFilterGeometry(self, layer: QgsMapLayer, selectedFeaturesOnly: bool = False) Sets a spatial filter for points to be exported based on the features of layer. Points that do not intersect the layer’s features will be skipped.

Parameters:

geometry (QgsAbstractGeometry) –

setFormat(self, format: QgsPointCloudLayerExporter.ExportFormat) bool

Sets the format for the exported file.

Return type:

bool

Returns:

true if the format is supported, false otherwise.

See also

ExportFormat

Parameters:

format (QgsPointCloudLayerExporter.ExportFormat) –

setLayerName(self, name: str)

Sets the name for the new layer.

Parameters:

name (str) –

setNoAttributes(self)

Sets that no attributes will be exported.

Note

This has no effect when exporting to LAS/LAZ format.

setPointsLimit(self, limit: int)

Sets the maximum number of points to be exported. Default value is 0.

Note

Any limit value <= 0 means no limit.

Parameters:

limit (int) –

setZRange(self, zRange: QgsDoubleRange)

Sets an inclusive range for Z values to be exported. Points with Z values outside the range will be skipped.

Parameters:

zRange (QgsDoubleRange) –

takeExportedLayer(self) QgsMapLayer

Gets a pointer to the exported layer. Caller takes ownership of the returned object.

Return type:

QgsMapLayer

zRange(self) QgsDoubleRange

Gets the inclusive range for Z values to be exported.

Return type:

QgsDoubleRange