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¶
Base classes¶
Subclasses¶
Handles logging of incoming GPS data to a vector layer. |
Methods
Adds a track vertex at the current GPS location. |
|
Returns |
|
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. |
|
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. |
Virtual Methods
In PyQGIS, only methods marked as virtual
can be safely overridden in a Python subclass of QgsGpsLogger. See the FAQ for more details.
Sets the coordinate transform context to be used when transforming GPS coordinates. |
Signals
Emitted whenever the distance area used to calculate track distances is changed. |
|
Emitted whenever the associated GPS device state is changed. |
|
Emitted whenever the current track changes from being empty to non-empty or vice versa. |
|
Emitted whenever the current track is reset. |
|
Emitted whenever a new vertex is added to the track. |
- 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:
connection (Optional[QgsGpsConnection])
parent (Optional[QObject] = None)
- automaticallyAddTrackVertices(self) bool [source]¶
Returns
True
if track vertices will be automatically added whenever the GPS position is changed.See also
- 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
- 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:
- signal distanceAreaChanged[source]¶
Emitted whenever the distance area used to calculate track distances is changed.
- 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:
- 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
- setAutomaticallyAddTrackVertices(self, enabled: bool)[source]¶
Sets whether track vertices will be automatically added whenever the GPS position is changed.
See also
- Parameters:
enabled (bool)
- setConnection(self, connection: QgsGpsConnection | None)[source]¶
Sets the associated GPS connection.
See also
- 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.See also
- Parameters:
context (QgsCoordinateTransformContext)
- signal stateChanged(info: QgsGpsInformation)[source]¶
Emitted whenever the associated GPS device state is changed.
- Parameters:
info (QgsGpsInformation)
- 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(isEmpty: bool)[source]¶
Emitted whenever the current track changes from being empty to non-empty or vice versa.
- Parameters:
isEmpty (bool)
- 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(vertex: QgsPoint)[source]¶
Emitted whenever a new vertex is added to the track.
The
vertex
point will be in WGS84 coordinate reference system.- Parameters:
vertex (QgsPoint)
- transformContext(self) QgsCoordinateTransformContext [source]¶
Returns the coordinate transform context to be used when transforming GPS coordinates.
See also
- Return type: