Class: QgsGpsLogger¶
- class qgis.core.QgsGpsLogger¶
Bases:
PyQt5.QtCore.QObject
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.
New in version 3.30.
QgsGpsLogger(connection:
QgsGpsConnection
, parent: QObject = None) Constructor forQgsGpsLogger
with the specifiedparent
object.The logger will automatically record GPS information from the specified
connection
.Methods
Adds a track vertex at the current GPS location.
Returns
True
if track vertices will be automatically added whenever the GPS position is changed.Returns the value of the corresponding GPS information
component
.Returns the associated GPS connection.
Returns the current logged GPS positions as a geometry of the specified
type
.Returns the recorded points in the current track.
Returns the distance area calculator which should be used for calculating distances associated with the GPS log.
Returns the last recorded elevation the device.
Returns the last recorded value corresponding to the QgsGpsLogger.settingsGpsMValueComponent setting.
Returns the last recorded position of the device.
Returns the last recorded timestamp from the device.
Resets the current track, discarding all recorded points.
Sets whether track vertices will be automatically added whenever the GPS position is changed.
Sets the associated GPS connection.
Sets the
ellipsoid
which will be used for calculating distances in the log.Sets the coordinate transform
context
to be used when transforming GPS coordinates.Returns the total length of the current digitized track (in meters).
Returns the direct length from the first vertex in the track to the last (in meters).
Returns the timestamp at which the current track was started.
Returns the coordinate transform context to be used when transforming GPS coordinates.
Should be called whenever the QGIS GPS settings are changed.
Signals
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
- addTrackVertex(self)¶
Adds a track vertex at the current GPS location.
- automaticallyAddTrackVertices(self) bool ¶
Returns
True
if track vertices will be automatically added whenever the GPS position is changed.See also
- Return type:
bool
- childEvent(self, QChildEvent)¶
- componentValue(self, component: Qgis.GpsInformationComponent) Any ¶
Returns the value of the corresponding GPS information
component
.- Parameters:
component (Qgis.GpsInformationComponent) –
- Return type:
Any
- connectNotify(self, QMetaMethod)¶
- connection(self) QgsGpsConnection ¶
Returns the associated GPS connection.
See also
- Return type:
- currentGeometry(self, type: Qgis.WkbType) Tuple[QgsGeometry, str] ¶
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) – desired geometry type
- Return type:
Tuple[
QgsGeometry
, str]- 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]
- customEvent(self, QEvent)¶
- disconnectNotify(self, QMetaMethod)¶
- distanceArea(self) QgsDistanceArea ¶
Returns the distance area calculator which should be used for calculating distances associated with the GPS log.
- Return type:
- distanceAreaChanged¶
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.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- isSignalConnected(self, QMetaMethod) bool ¶
- lastElevation(self) float ¶
Returns the last recorded elevation the device.
- Return type:
float
- lastMValue(self) float ¶
Returns the last recorded value corresponding to the QgsGpsLogger.settingsGpsMValueComponent setting.
- Return type:
float
- lastPosition(self) QgsPointXY ¶
Returns the last recorded position of the device.
The returned point will always be in WGS84 coordinate reference system.
- Return type:
- lastTimestamp(self) QDateTime ¶
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
- receivers(self, PYQT_SIGNAL) int ¶
- resetTrack(self)¶
Resets the current track, discarding all recorded points.
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setAutomaticallyAddTrackVertices(self, enabled: bool)¶
Sets whether track vertices will be automatically added whenever the GPS position is changed.
See also
- Parameters:
enabled (bool) –
- setConnection(self, connection: QgsGpsConnection)¶
Sets the associated GPS connection.
See also
- Parameters:
connection (QgsGpsConnection) –
- setEllipsoid(self, ellipsoid: str)¶
Sets the
ellipsoid
which will be used for calculating distances in the log.- Parameters:
ellipsoid (str) –
- setTransformContext(self, context: QgsCoordinateTransformContext)¶
Sets the coordinate transform
context
to be used when transforming GPS coordinates.See also
- Parameters:
context (QgsCoordinateTransformContext) –
- stateChanged¶
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.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- timerEvent(self, QTimerEvent)¶
- totalTrackLength(self) float ¶
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 ¶
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
- trackIsEmptyChanged¶
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.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- trackReset¶
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.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- trackStartTime(self) QDateTime ¶
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
- trackVertexAdded¶
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.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- transformContext(self) QgsCoordinateTransformContext ¶
Returns the coordinate transform context to be used when transforming GPS coordinates.
See also
- Return type:
- updateGpsSettings(self)¶
Should be called whenever the QGIS GPS settings are changed.