QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
QgsPointCloudLayerExporter Class Reference

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

#include <qgspointcloudlayerexporter.h>

Public Types

enum class  ExportFormat : int {
  Memory = 0 , Las = 1 , Gpkg = 2 , Shp = 3 ,
  Dxf = 4 , Csv = 5
}
 Supported export formats for point clouds. More...
 

Public Member Functions

 QgsPointCloudLayerExporter (QgsPointCloudLayer *layer)
 Constructor for QgsPointCloudLayerExporter, associated with the specified layer. More...
 
 ~QgsPointCloudLayerExporter ()
 
QStringList attributes () const
 Gets the list of point cloud attributes that will be exported. More...
 
QgsCoordinateReferenceSystem crs () const
 Gets the crs for the exported file. More...
 
void doExport ()
 Performs the actual exporting operation. More...
 
QgsFeedbackfeedback () const
 Gets a pointer to the QgsFeedback object used for cancellation / progress reporting, or nullptr if not set. More...
 
QString fileName () const
 Gets the filename for the new layer. More...
 
QgsRectangle filterExtent () const
 Gets the filter extent for points to be exported. More...
 
ExportFormat format () const
 Returns the format for the exported file or layer. More...
 
QString lastError () const
 Gets the last error that occurred during the exporting operation. More...
 
QString layerName () const
 Gets the name for the new layer. More...
 
qint64 pointsLimit ()
 Gets the maximum number of points to be exported. More...
 
void prepareExport ()
 Creates the QgsVectorLayer for exporting to a memory layer, if necessary. More...
 
void setActionOnExistingFile (const QgsVectorFileWriter::ActionOnExistingFile action)
 Sets whether an existing output vector file should be overwritten on appended to. More...
 
void setAllAttributes ()
 Sets that all attributes will be exported. More...
 
void setAttributes (const QStringList &attributes)
 Sets the list of point cloud attributes that will be exported. More...
 
void setCrs (const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context=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. More...
 
void setFeedback (QgsFeedback *feedback)
 Sets a QgsFeedback object to allow cancellation / progress reporting. More...
 
void setFileName (const QString &filename)
 Sets the filename for the new layer. More...
 
void setFilterExtent (const QgsRectangle extent)
 Sets a filter extent for points to be exported in the target CRS Points that fall outside the extent will be skipped. More...
 
void setFilterGeometry (const QgsAbstractGeometry *geometry)
 Sets a spatial filter for points to be exported based on geom in the point cloud's CRS. More...
 
void setFilterGeometry (QgsMapLayer *layer, bool selectedFeaturesOnly=false)
 Sets a spatial filter for points to be exported based on the features of layer. More...
 
bool setFormat (const ExportFormat format)
 Sets the format for the exported file. More...
 
void setLayerName (const QString &name)
 Sets the name for the new layer. More...
 
void setNoAttributes ()
 Sets that no attributes will be exported. More...
 
void setPointsLimit (qint64 limit)
 Sets the maximum number of points to be exported. More...
 
void setZRange (const QgsDoubleRange zRange)
 Sets an inclusive range for Z values to be exported. More...
 
QgsMapLayertakeExportedLayer ()
 Gets a pointer to the exported layer. More...
 
QgsDoubleRange zRange () const
 Gets the inclusive range for Z values to be exported. More...
 

Static Public Member Functions

static QString getOgrDriverName (ExportFormat format)
 Gets the OGR driver name for the specified format. More...
 
static QList< ExportFormatsupportedFormats ()
 Gets a list of the supported export formats. More...
 

Detailed Description

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

Since
QGIS 3.28

Definition at line 44 of file qgspointcloudlayerexporter.h.

Member Enumeration Documentation

◆ ExportFormat

Supported export formats for point clouds.

Enumerator
Memory 

Memory layer.

Las 

LAS/LAZ point cloud.

Gpkg 

Geopackage.

Shp 

ESRI ShapeFile.

Dxf 

AutoCAD dxf.

Csv 

Comma separated values.

Definition at line 51 of file qgspointcloudlayerexporter.h.

Constructor & Destructor Documentation

◆ QgsPointCloudLayerExporter()

QgsPointCloudLayerExporter::QgsPointCloudLayerExporter ( QgsPointCloudLayer layer)

Constructor for QgsPointCloudLayerExporter, associated with the specified layer.

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

Definition at line 54 of file qgspointcloudlayerexporter.cpp.

◆ ~QgsPointCloudLayerExporter()

QgsPointCloudLayerExporter::~QgsPointCloudLayerExporter ( )

Definition at line 68 of file qgspointcloudlayerexporter.cpp.

Member Function Documentation

◆ attributes()

QStringList QgsPointCloudLayerExporter::attributes ( ) const
inline

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

Definition at line 183 of file qgspointcloudlayerexporter.h.

◆ crs()

QgsCoordinateReferenceSystem QgsPointCloudLayerExporter::crs ( ) const
inline

Gets the crs for the exported file.

Definition at line 194 of file qgspointcloudlayerexporter.h.

◆ doExport()

void QgsPointCloudLayerExporter::doExport ( )

Performs the actual exporting operation.

Definition at line 204 of file qgspointcloudlayerexporter.cpp.

◆ feedback()

QgsFeedback * QgsPointCloudLayerExporter::feedback ( ) const
inline

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

Definition at line 160 of file qgspointcloudlayerexporter.h.

◆ fileName()

QString QgsPointCloudLayerExporter::fileName ( ) const
inline

Gets the filename for the new layer.

Definition at line 103 of file qgspointcloudlayerexporter.h.

◆ filterExtent()

QgsRectangle QgsPointCloudLayerExporter::filterExtent ( ) const
inline

Gets the filter extent for points to be exported.

Definition at line 125 of file qgspointcloudlayerexporter.h.

◆ format()

ExportFormat QgsPointCloudLayerExporter::format ( ) const
inline

Returns the format for the exported file or layer.

Definition at line 206 of file qgspointcloudlayerexporter.h.

◆ getOgrDriverName()

QString QgsPointCloudLayerExporter::getOgrDriverName ( ExportFormat  format)
static

Gets the OGR driver name for the specified format.

Note
Not available in python bindings

Definition at line 35 of file qgspointcloudlayerexporter.cpp.

◆ lastError()

QString QgsPointCloudLayerExporter::lastError ( ) const
inline

Gets the last error that occurred during the exporting operation.

If no error occurred an empty string is returned.

Definition at line 247 of file qgspointcloudlayerexporter.h.

◆ layerName()

QString QgsPointCloudLayerExporter::layerName ( ) const
inline

Gets the name for the new layer.

Definition at line 113 of file qgspointcloudlayerexporter.h.

◆ pointsLimit()

qint64 QgsPointCloudLayerExporter::pointsLimit ( )
inline

Gets the maximum number of points to be exported.

0 means no limit.

Definition at line 217 of file qgspointcloudlayerexporter.h.

◆ prepareExport()

void QgsPointCloudLayerExporter::prepareExport ( )

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().

Definition at line 190 of file qgspointcloudlayerexporter.cpp.

◆ setActionOnExistingFile()

void QgsPointCloudLayerExporter::setActionOnExistingFile ( const QgsVectorFileWriter::ActionOnExistingFile  action)
inline

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

Note
Only applies to vector formats

Definition at line 223 of file qgspointcloudlayerexporter.h.

◆ setAllAttributes()

void QgsPointCloudLayerExporter::setAllAttributes ( )

Sets that all attributes will be exported.

Definition at line 148 of file qgspointcloudlayerexporter.cpp.

◆ setAttributes()

void QgsPointCloudLayerExporter::setAttributes ( const QStringList &  attributes)

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.

Definition at line 129 of file qgspointcloudlayerexporter.cpp.

◆ setCrs()

void QgsPointCloudLayerExporter::setCrs ( const QgsCoordinateReferenceSystem crs,
const QgsCoordinateTransformContext context = QgsCoordinateTransformContext() 
)
inline

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.

Definition at line 189 of file qgspointcloudlayerexporter.h.

◆ setFeedback()

void QgsPointCloudLayerExporter::setFeedback ( QgsFeedback feedback)
inline

Sets a QgsFeedback object to allow cancellation / progress reporting.

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

Definition at line 155 of file qgspointcloudlayerexporter.h.

◆ setFileName()

void QgsPointCloudLayerExporter::setFileName ( const QString &  filename)
inline

Sets the filename for the new layer.

Definition at line 98 of file qgspointcloudlayerexporter.h.

◆ setFilterExtent()

void QgsPointCloudLayerExporter::setFilterExtent ( const QgsRectangle  extent)
inline

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()

Definition at line 120 of file qgspointcloudlayerexporter.h.

◆ setFilterGeometry() [1/2]

void QgsPointCloudLayerExporter::setFilterGeometry ( const QgsAbstractGeometry geometry)

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.

Definition at line 85 of file qgspointcloudlayerexporter.cpp.

◆ setFilterGeometry() [2/2]

void QgsPointCloudLayerExporter::setFilterGeometry ( QgsMapLayer layer,
bool  selectedFeaturesOnly = 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.

Definition at line 91 of file qgspointcloudlayerexporter.cpp.

◆ setFormat()

bool QgsPointCloudLayerExporter::setFormat ( const ExportFormat  format)

Sets the format for the exported file.

Returns
true if the format is supported, false otherwise.
See also
ExportFormat

Definition at line 75 of file qgspointcloudlayerexporter.cpp.

◆ setLayerName()

void QgsPointCloudLayerExporter::setLayerName ( const QString &  name)
inline

Sets the name for the new layer.

Definition at line 108 of file qgspointcloudlayerexporter.h.

◆ setNoAttributes()

void QgsPointCloudLayerExporter::setNoAttributes ( )
inline

Sets that no attributes will be exported.

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

Definition at line 173 of file qgspointcloudlayerexporter.h.

◆ setPointsLimit()

void QgsPointCloudLayerExporter::setPointsLimit ( qint64  limit)
inline

Sets the maximum number of points to be exported.

Default value is 0.

Note
Any limit value <= 0 means no limit.

Definition at line 212 of file qgspointcloudlayerexporter.h.

◆ setZRange()

void QgsPointCloudLayerExporter::setZRange ( const QgsDoubleRange  zRange)
inline

Sets an inclusive range for Z values to be exported.

Points with Z values outside the range will be skipped.

Definition at line 143 of file qgspointcloudlayerexporter.h.

◆ supportedFormats()

static QList< ExportFormat > QgsPointCloudLayerExporter::supportedFormats ( )
inlinestatic

Gets a list of the supported export formats.

See also
setFormat()

Definition at line 66 of file qgspointcloudlayerexporter.h.

◆ takeExportedLayer()

QgsMapLayer * QgsPointCloudLayerExporter::takeExportedLayer ( )

Gets a pointer to the exported layer.

Caller takes ownership of the returned object.

Definition at line 278 of file qgspointcloudlayerexporter.cpp.

◆ zRange()

QgsDoubleRange QgsPointCloudLayerExporter::zRange ( ) const
inline

Gets the inclusive range for Z values to be exported.

Definition at line 148 of file qgspointcloudlayerexporter.h.


The documentation for this class was generated from the following files: