Class: QgsGpsLogger

Base class for objects which log incoming GPS data.

This class handles generic logic regarding logging GPS data, such as creation of tracks from incoming GPS location points.

Added in version 3.30.

Class Hierarchy

Inheritance diagram of qgis.core.QgsGpsLogger

Base classes

QObject

Subclasses

QgsVectorLayerGpsLogger

Handles logging of incoming GPS data to a vector layer.

class qgis.core.QgsGpsLogger[source]

Bases: QObject

__init__(connection: QgsGpsConnection | None, parent: QObject | None = None)

Constructor for QgsGpsLogger with the specified parent object.

The logger will automatically record GPS information from the specified connection.

Parameters:
addTrackVertex(self)[source]

Adds a track vertex at the current GPS location.

automaticallyAddTrackVertices(self) bool[source]

Returns True if track vertices will be automatically added whenever the GPS position is changed.

Return type:

bool

componentValue(self, component: Qgis.GpsInformationComponent) Any[source]

Returns the value of the corresponding GPS information component.

Parameters:

component (Qgis.GpsInformationComponent)

Return type:

Any

connection(self) QgsGpsConnection | None[source]

Returns the associated GPS connection.

See also

setConnection()

Return type:

Optional[QgsGpsConnection]

currentGeometry(self, type: Qgis.WkbType)[source]

Returns the current logged GPS positions as a geometry of the specified type.

The returned geometries will always be in the WGS84 (EPSG:4326) coordinate reference system.

Parameters:

type (Qgis.WkbType) -> (QgsGeometry) – desired geometry type

Returns:

  • logged GPS positions as a geometry.

  • error: Will be set to a user-friendly error if the logged positions could not be converted to an appropriate geometry

currentTrack(self) List[QgsPoint]

Returns the recorded points in the current track.

These points will always be in WGS84 coordinate reference system.

Return type:

List[QgsPoint]

distanceArea(self) QgsDistanceArea

Returns the distance area calculator which should be used for calculating distances associated with the GPS log.

Return type:

QgsDistanceArea

signal distanceAreaChanged[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.

lastElevation(self) float[source]

Returns the last recorded elevation the device.

Return type:

float

lastMValue(self) float[source]

Returns the last recorded value corresponding to the QgsGpsLogger.settingsGpsMValueComponent setting.

Return type:

float

lastPosition(self) QgsPointXY[source]

Returns the last recorded position of the device.

The returned point will always be in WGS84 coordinate reference system.

Return type:

QgsPointXY

lastTimestamp(self) QDateTime[source]

Returns the last recorded timestamp from the device.

The returned time value will respect all user settings regarding GPS time zone handling.

Return type:

QDateTime

resetTrack(self)[source]

Resets the current track, discarding all recorded points.

setAutomaticallyAddTrackVertices(self, enabled: bool)[source]

Sets whether track vertices will be automatically added whenever the GPS position is changed.

Parameters:

enabled (bool)

setConnection(self, connection: QgsGpsConnection | None)[source]

Sets the associated GPS connection.

See also

connection()

Parameters:

connection (Optional[QgsGpsConnection])

setEllipsoid(self, ellipsoid: str | None)[source]

Sets the ellipsoid which will be used for calculating distances in the log.

Parameters:

ellipsoid (Optional[str])

virtual setTransformContext(self, context: QgsCoordinateTransformContext)[source]

Sets the coordinate transform context to be used when transforming GPS coordinates.

Parameters:

context (QgsCoordinateTransformContext)

signal stateChanged[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.

totalTrackLength(self) float[source]

Returns the total length of the current digitized track (in meters).

The returned length is calculated using ellipsoidal calculations.

Return type:

float

trackDistanceFromStart(self) float[source]

Returns the direct length from the first vertex in the track to the last (in meters).

The returned length is calculated using ellipsoidal calculations.

Return type:

float

signal trackIsEmptyChanged[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 trackReset[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.

trackStartTime(self) QDateTime[source]

Returns the timestamp at which the current track was started.

The returned time value will respect all user settings regarding GPS time zone handling.

Return type:

QDateTime

signal trackVertexAdded[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.

transformContext(self) QgsCoordinateTransformContext[source]

Returns the coordinate transform context to be used when transforming GPS coordinates.

Return type:

QgsCoordinateTransformContext

updateGpsSettings(self)[source]

Should be called whenever the QGIS GPS settings are changed.