Class: QgsMapToolDigitizeFeature

This tool digitizes geometry of new point/line/polygon features on already existing vector layers.

Once the map tool is enabled, user can digitize the feature geometry. A signal will then be emitted.

Added in version 3.10.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsMapToolDigitizeFeature

Base classes

QgsMapToolCaptureLayerGeometry

Base class for map tools digitizing layer geometries.

QgsMapToolCapture

Base class for map tools capable of capturing point, lines and polygons.

QgsMapToolAdvancedDigitizing

A QgsMapTool which gives events directly in map coordinates and allows filtering of events.

QgsMapToolEdit

Base class for map tools that edit vector geometry.

QgsMapTool

Abstract base class for all map tools.

QObject

class qgis.gui.QgsMapToolDigitizeFeature[source]

Bases: QgsMapToolCaptureLayerGeometry

__init__(canvas: QgsMapCanvas | None, cadDockWidget: QgsAdvancedDigitizingDockWidget | None, mode: QgsMapToolCapture.CaptureMode = QgsMapToolCapture.CaptureNone)

QgsMapToolDigitizeFeature is a map tool to digitize a feature geometry

Parameters:
  • canvas (Optional[QgsMapCanvas]) – the map canvas

  • cadDockWidget (Optional[QgsAdvancedDigitizingDockWidget]) – widget to setup advanced digitizing parameters

  • mode (QgsMapToolCapture.CaptureMode = QgsMapToolCapture.CaptureNone) – type of geometry to capture (point/line/polygon), QgsMapToolCapture.CaptureNone to autodetect geometry

checkGeometryType(self) bool[source]

Check if CaptureMode matches layer type. Default is True.

Return type:

bool

signal digitizingCanceled[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 digitizingCompleted[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 digitizingFinished[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.

virtual featureDigitized(self, feature: QgsFeature)[source]

Called when the feature has been digitized

Added in version 3.26.

Parameters:

feature (QgsFeature)

virtual layerGeometryCaptured(self, geometry: QgsGeometry)[source]

Called when the feature has been digitized.

Parameters:

geometry (QgsGeometry) – the digitized geometry

setCheckGeometryType(self, checkGeometryType: bool)[source]

Check if CaptureMode matches layer type. Default is True.

Parameters:

checkGeometryType (bool)

setLayer(self, vl: QgsMapLayer | None)[source]

Change the layer edited by the map tool

Parameters:

vl (Optional[QgsMapLayer]) – the layer to be edited by the map tool