Class: QgsProjectGpsSettings

Contains settings and properties relating to how a QgsProject should interact with a GPS device.

Added in version 3.30.

Class Hierarchy

Inheritance diagram of qgis.core.QgsProjectGpsSettings

Base classes

QObject

Methods

automaticallyAddTrackVertices

Returns True if track vertices should be automatically created whenever new locations are received from the GPS device.

automaticallyCommitFeatures

Returns True if features created from GPS locations should be immediately committed to their target layers (skipping the usual layer edit buffer).

destinationFollowsActiveLayer

Returns True if the destination layer for storing features digitized from GPS should follow the current active layer automatically.

destinationLayer

Returns the destination layer to be used for storing features digitized from GPS.

destinationTimeStampField

Returns the destination time stamp field name for the current destinationLayer(), or an empty string if time stamps should not be automatically saved.

destinationTimeStampFields

Returns the map of destination layer ID to target time stamp field name.

readXml

Reads the settings's state from a DOM element.

reset

Resets the settings to a default state.

resolveReferences

Resolves reference to layers from stored layer ID (if it has not been resolved already)

setAutomaticallyAddTrackVertices

Sets whether track vertices should be automatically created whenever new locations are received from the GPS device.

setAutomaticallyCommitFeatures

Sets whether features created from GPS locations should be immediately committed to their target layers (skipping the usual layer edit buffer).

setDestinationFollowsActiveLayer

Sets whether the destination layer for storing features digitized from GPS should follow the current active layer automatically.

setDestinationLayer

Sets the destination layer to be used for storing features digitized from GPS.

setDestinationTimeStampField

Sets the destination field name for automatically storing timestamps in the specified destination layer.

writeXml

Returns a DOM element representing the settings.

Signals

automaticallyAddTrackVerticesChanged

Emitted whenever the automaticallyAddTrackVertices() setting is changed.

automaticallyCommitFeaturesChanged

Emitted whenever the automaticallyCommitFeatures() setting is changed.

destinationFollowsActiveLayerChanged

Emitted whenever the destinationFollowsActiveLayer() setting is changed.

destinationLayerChanged

Emitted whenever the destination layer for features digitized from GPS is changed.

destinationTimeStampFieldChanged

Emitted whenever the destination field for automatic time stamps is changed.

class qgis.core.QgsProjectGpsSettings[source]

Bases: QObject

__init__(parent: QObject | None = None)

Constructor for QgsProjectGpsSettings with the specified parent object.

Parameters:

parent (Optional[QObject] = None)

automaticallyAddTrackVertices(self) bool[source]

Returns True if track vertices should be automatically created whenever new locations are received from the GPS device.

Return type:

bool

signal automaticallyAddTrackVerticesChanged(enabled: bool)[source]

Emitted whenever the automaticallyAddTrackVertices() setting is changed.

Parameters:

enabled (bool)

automaticallyCommitFeatures(self) bool[source]

Returns True if features created from GPS locations should be immediately committed to their target layers (skipping the usual layer edit buffer).

Return type:

bool

signal automaticallyCommitFeaturesChanged(enabled: bool)[source]

Emitted whenever the automaticallyCommitFeatures() setting is changed.

Parameters:

enabled (bool)

destinationFollowsActiveLayer(self) bool[source]

Returns True if the destination layer for storing features digitized from GPS should follow the current active layer automatically.

Return type:

bool

signal destinationFollowsActiveLayerChanged(follows: bool)[source]

Emitted whenever the destinationFollowsActiveLayer() setting is changed.

Parameters:

follows (bool)

destinationLayer(self) QgsVectorLayer | None[source]

Returns the destination layer to be used for storing features digitized from GPS.

Note

If destinationFollowsActiveLayer() is True then this layer will be changed whenever the user changes the active layer in the QGIS interface.

Return type:

Optional[QgsVectorLayer]

signal destinationLayerChanged(layer: QgsVectorLayer)[source]

Emitted whenever the destination layer for features digitized from GPS is changed.

Parameters:

layer (QgsVectorLayer)

destinationTimeStampField(self) str[source]

Returns the destination time stamp field name for the current destinationLayer(), or an empty string if time stamps should not be automatically saved.

Return type:

str

signal destinationTimeStampFieldChanged(field: str)[source]

Emitted whenever the destination field for automatic time stamps is changed.

The field argument will be an empty string if time stamps should not be automatically saved.

Parameters:

field (str)

destinationTimeStampFields(self) Dict[str, str]

Returns the map of destination layer ID to target time stamp field name.

Return type:

Dict[str, str]

readXml(self, element: QDomElement, context: QgsReadWriteContext) bool[source]

Reads the settings’s state from a DOM element.

See also

writeXml()

Parameters:
Return type:

bool

reset(self)[source]

Resets the settings to a default state.

resolveReferences(self, project: QgsProject | None)[source]

Resolves reference to layers from stored layer ID (if it has not been resolved already)

Parameters:

project (Optional[QgsProject])

setAutomaticallyAddTrackVertices(self, enabled: bool)[source]

Sets whether track vertices should be automatically created whenever new locations are received from the GPS device.

Parameters:

enabled (bool)

setAutomaticallyCommitFeatures(self, enabled: bool)[source]

Sets whether features created from GPS locations should be immediately committed to their target layers (skipping the usual layer edit buffer).

Parameters:

enabled (bool)

setDestinationFollowsActiveLayer(self, follow: bool)[source]

Sets whether the destination layer for storing features digitized from GPS should follow the current active layer automatically.

Parameters:

follow (bool)

setDestinationLayer(self, layer: QgsVectorLayer | None)[source]

Sets the destination layer to be used for storing features digitized from GPS.

Note

If destinationFollowsActiveLayer() is True then this layer will be changed whenever the user changes the active layer in the QGIS interface.

Parameters:

layer (Optional[QgsVectorLayer])

setDestinationTimeStampField(self, layer: QgsVectorLayer | None, field: str | None)[source]

Sets the destination field name for automatically storing timestamps in the specified destination layer.

Set field argument to an empty string if time stamps should not be automatically saved.

Parameters:
writeXml(self, doc: QDomDocument, context: QgsReadWriteContext) QDomElement[source]

Returns a DOM element representing the settings.

See also

readXml()

Parameters:
Return type:

QDomElement