Class: QgsVectorLayerSaveAsDialog

A dialog for configuring vector layer save to file operations.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsVectorLayerSaveAsDialog

Base classes

QDialog

QWidget

QObject

QPaintDevice

class qgis.gui.QgsVectorLayerSaveAsDialog[source]

Bases: QDialog

__init__(layer: QgsVectorLayer | None, options: QgsVectorLayerSaveAsDialog.Options | QgsVectorLayerSaveAsDialog.Option = QgsVectorLayerSaveAsDialog.Option.AllOptions, parent: QWidget | None = None, fl: Qt.WindowFlags | Qt.WindowType = Qt.WindowFlags())

Construct a new QgsVectorLayerSaveAsDialog

Parameters:
class Option(*values)

Bases: IntEnum

Available dialog options.

  • Symbology: Show symbology options

  • DestinationCrs: Show destination CRS (reprojection) option

  • Fields: Show field customization group

  • AddToCanvas: Show add to map option

  • SelectedOnly: Show selected features only option

  • GeometryType: Show geometry group

  • Extent: Show extent group

  • Metadata: Show metadata options

  • AllOptions:

AddToCanvas = 16
AllOptions = -1
DestinationCrs = 4
Extent = 128
Fields = 8
GeometryType = 64
Metadata = 256
SelectedOnly = 32
Symbology = 1
class Options
class Options(f: QgsVectorLayerSaveAsDialog.Options | QgsVectorLayerSaveAsDialog.Option)
class Options(a0: QgsVectorLayerSaveAsDialog.Options)

Bases: object

addToCanvas(self) bool[source]

Returns True if the “add to canvas” checkbox is checked.

See also

setAddToCanvas()

Return type:

bool

attributesAsDisplayedValues(self) List[int][source]

Returns selected attributes that must be exported with their displayed values instead of their raw values.

Return type:

List[int]

attributesExportNames(self) List[str][source]

Returns a list of export names for attributes.

Return type:

List[str]

automaticGeometryType(self) bool[source]

Returns True if geometry type is set to automatic.

See also

geometryType()

Return type:

bool

creationActionOnExistingFile(self) QgsVectorFileWriter.ActionOnExistingFile[source]

Returns the creation action.

Return type:

QgsVectorFileWriter.ActionOnExistingFile

crs(self) QgsCoordinateReferenceSystem[source]

Returns the CRS chosen for export.

Added in version 3.14.

Return type:

QgsCoordinateReferenceSystem

datasourceOptions(self) List[str][source]

Returns a list of additional data source options which are passed to OGR. Refer to the OGR documentation for the target format for available options.

See also

layerOptions()

Return type:

List[str]

encoding(self) str[source]

Returns the selected encoding for the target file.

Return type:

str

fileName(self) str[source]

Returns the target filename.

See also

layerName()

Return type:

str

filterExtent(self) QgsRectangle[source]

Determines the extent to be exported.

Return type:

QgsRectangle

forceMulti(self) bool[source]

Returns True if force multi geometry type is checked.

See also

includeZ()

See also

setForceMulti()

Return type:

bool

format(self) str[source]

Returns the selected format in which the export should be written.

See also

QgsVectorFileWriter.filterForDriver()

Return type:

str

geometryType(self) Qgis.WkbType[source]

Returns the selected flat geometry type for the export.

See also

forceMulti()

See also

includeZ()

Return type:

Qgis.WkbType

hasFilterExtent(self) bool[source]

Determines if filtering the export by an extent is activated.

See also

filterExtent()

Return type:

bool

includeZ(self) bool[source]

Returns True if include z dimension is checked.

See also

forceMulti()

See also

setIncludeZ()

Return type:

bool

layerName(self) str[source]

Returns the target layer name.

See also

fileName()

Return type:

str

layerOptions(self) List[str][source]

Returns a list of additional layer options which are passed to OGR. Refer to the OGR documentation for the target format for available options.

Return type:

List[str]

onlySelected(self) bool[source]

Returns whether only selected features will be saved.

Return type:

bool

persistMetadata(self) bool[source]

Returns True if the persist metadata (copy source metadata to destination layer) option is checked.

Added in version 3.20.

Return type:

bool

scale(self) float[source]

Returns the specified map scale. The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.

Return type:

float

selectedAttributes(self) List[int][source]

Returns a list of attributes which are selected for saving.

Return type:

List[int]

setAddToCanvas(self, checked: bool)[source]

Sets whether the “add to canvas” checkbox should be checked.

See also

addToCanvas()

Added in version 3.6.

Parameters:

checked (bool)

setForceMulti(self, checked: bool)[source]

Sets whether the force multi geometry checkbox should be checked.

See also

forceMulti()

Parameters:

checked (bool)

setIncludeZ(self, checked: bool)[source]

Sets whether the include z dimension checkbox should be checked.

See also

includeZ()

Parameters:

checked (bool)

setMapCanvas(self, canvas: QgsMapCanvas | None)[source]

Sets a map canvas to associate with the dialog.

Parameters:

canvas (Optional[QgsMapCanvas])

setOnlySelected(self, onlySelected: bool)[source]

Sets whether only selected features will be saved.

See also

onlySelected()

Parameters:

onlySelected (bool)

symbologyExport(self) Qgis.FeatureSymbologyExport[source]

Returns type of symbology export.

Return type:

Qgis.FeatureSymbologyExport