Class: QgsPointCloudLayerExporter

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

Added in version 3.28.

class qgis.core.QgsPointCloudLayerExporter[source]

Bases: object

__init__(layer: QgsPointCloudLayer | None)

Constructor for QgsPointCloudLayerExporter, associated with the specified layer.

Note

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

Parameters:

layer (Optional[QgsPointCloudLayer])

class ExportFormat(*values)

Bases: 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][source]

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

Return type:

List[str]

crs(self) QgsCoordinateReferenceSystem[source]

Gets the crs for the exported file.

Return type:

QgsCoordinateReferenceSystem

doExport(self)[source]

Performs the actual exporting operation.

feedback(self) QgsFeedback | None[source]

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

Return type:

Optional[QgsFeedback]

fileName(self) str[source]

Gets the filename for the new layer.

Return type:

str

filterExtent(self) QgsRectangle[source]

Gets the filter extent for points to be exported.

Return type:

QgsRectangle

format(self) QgsPointCloudLayerExporter.ExportFormat[source]

Returns the format for the exported file or layer.

Return type:

QgsPointCloudLayerExporter.ExportFormat

lastError(self) str[source]

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[source]

Gets the name for the new layer.

Return type:

str

pointsLimit(self) int[source]

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

Return type:

int

prepareExport(self)[source]

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)[source]

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)[source]

Sets that all attributes will be exported.

setAttributes(self, attributes: Iterable[str | None])[source]

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[Optional[str]])

setCrs(self, crs: QgsCoordinateReferenceSystem, context: QgsCoordinateTransformContext = QgsCoordinateTransformContext())[source]

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 | None)[source]

Sets a QgsFeedback object to allow cancellation / progress reporting.

Note

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

Parameters:

feedback (Optional[QgsFeedback])

setFileName(self, filename: str | None)[source]

Sets the filename for the new layer.

Parameters:

filename (Optional[str])

setFilterExtent(self, extent: QgsRectangle)[source]

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 | None)[source]

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: Optional[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 (Optional[QgsAbstractGeometry])

setFormat(self, format: QgsPointCloudLayerExporter.ExportFormat) bool[source]

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 | None)[source]

Sets the name for the new layer.

Parameters:

name (Optional[str])

setNoAttributes(self)[source]

Sets that no attributes will be exported.

Note

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

setPointsLimit(self, limit: int)[source]

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)[source]

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 | None[source]

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

Return type:

Optional[QgsMapLayer]

zRange(self) QgsDoubleRange[source]

Gets the inclusive range for Z values to be exported.

Return type:

QgsDoubleRange