Class: QgsProfileExporterTask

Handles exports of elevation profiles in various formats in a background task.

Added in version 3.32.

Class Hierarchy

Inheritance diagram of qgis.core.QgsProfileExporterTask

Base classes

QgsTask

Abstract base class for long running background tasks.

QObject

Enums

ExportResult

Results of exporting the profile.

Methods

createdFiles

Returns a list of layer files created during the export.

error

Returns a descriptive error message, if available.

result

Returns the result of the export operation.

takeLayers

Returns a list of vector layer containing the exported profile results.

class qgis.core.QgsProfileExporterTask[source]

Bases: QgsTask

__init__(sources: Iterable[QgsAbstractProfileSource], request: QgsProfileRequest, type: Qgis.ProfileExportType, destination: str | None, transformContext: QgsCoordinateTransformContext)

Constructor for QgsProfileExporterTask, saving results to the specified destination file.

If destination is an empty string then the profile results will be generated only and can be retrieved by calling takeLayers().

Parameters:
class ExportResult(*values)

Bases: IntEnum

Results of exporting the profile.

  • Success: Successful export

  • Empty: Results were empty

  • DeviceError: Could not open output file device

  • DxfExportFailed: Generic error when outputting to DXF

  • LayerExportFailed: Generic error when outputting to files

  • Canceled: Export was canceled

Canceled = 5
DeviceError = 2
DxfExportFailed = 3
Empty = 1
LayerExportFailed = 4
Success = 0
createdFiles(self) List[str][source]

Returns a list of layer files created during the export.

Return type:

List[str]

error(self) str[source]

Returns a descriptive error message, if available.

Return type:

str

result(self) QgsProfileExporterTask.ExportResult[source]

Returns the result of the export operation.

See also

error()

Return type:

QgsProfileExporterTask.ExportResult

takeLayers(self) List[QgsVectorLayer]

Returns a list of vector layer containing the exported profile results.

While this method attempts to condense all results into a single layer, multiple layers may be returned when the geometry types of exported features differs.

Ownership of the returned layers is transferred to the caller.

Return type:

List[QgsVectorLayer]