Class: QgsVectorLayerExporterTask

QgsTask task which performs a QgsVectorLayerExporter layer export operation as a background task.

This can be used to export a vector layer out to a provider without blocking the QGIS interface.

Class Hierarchy

Inheritance diagram of qgis.core.QgsVectorLayerExporterTask

Base classes

QgsTask

Abstract base class for long running background tasks.

QObject

class qgis.core.QgsVectorLayerExporterTask[source]

Bases: QgsTask

__init__(layer: QgsVectorLayer | None, uri: str | None, providerKey: str | None, destinationCrs: QgsCoordinateReferenceSystem, options: Dict[str | None, Any] = {}, ownsLayer: bool = False)

Constructor for QgsVectorLayerExporterTask. Takes a source layer, destination uri and providerKey, and various export related parameters such as destination CRS and export options. ownsLayer has to be set to True if the task should take ownership of the layer and delete it after export.

Parameters:
__init__(layer: QgsVectorLayer | None, uri: str | None, providerKey: str | None, exportOptions: QgsVectorLayerExporter.ExportOptions, providerOptions: Dict[str | None, Any] = {}, ownsLayer: bool = False)

Constructor for QgsVectorLayerExporterTask. Takes a source layer, destination uri and providerKey, and various export related parameters via the exportOptions argument.

ownsLayer has to be set to True if the task should take ownership of the layer and delete it after export.

Added in version 3.44.

Parameters:
signal errorOccurred[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

signal exportComplete[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

static withLayerOwnership(layer: QgsVectorLayer | None, uri: str | None, providerKey: str | None, destinationCrs: QgsCoordinateReferenceSystem, options: Dict[str | None, Any] = {}) QgsVectorLayerExporterTask | None[source]

Creates a new QgsVectorLayerExporterTask which has ownership over a source layer. When the export task has completed (successfully or otherwise) layer will be deleted. The destination uri and providerKey, and various export related parameters such as destination CRS and export options must be specified.

Parameters:
Return type:

Optional[QgsVectorLayerExporterTask]