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

Static Public Member Functions

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

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 56 of file qgspointcloudlayerexporter.cpp.

◆ ~QgsPointCloudLayerExporter()

QgsPointCloudLayerExporter::~QgsPointCloudLayerExporter ( )

Definition at line 70 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 210 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 37 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 192 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 150 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 131 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 87 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 93 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 77 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 284 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: