GPXTrackWriter
public class GPXTrackWriter : LocationDelegate
extension GPXTrackWriter: NativeBase
extension GPXTrackWriter: Hashable
Writes GPX track points to GPXTrack.
The instance of the class should be added as a listener to the
LocationEngine for GPX track recording.
Appends the new location to the back segment of the track whenever the listener is called.
The following data (if provided) can be recorded and inserted into the resulting GPXTrack: latitude, longitude, altitude, time, bearingInDegrees, pitchInDegrees, speedInMetersPerSecond, horizontalAccuracyInMeters, verticalAccuracyInMeters, bearingAccuracyInDegrees, speedAccuracyInMetersPerSecond and locationTechnology.
Use case examples:
A user wants to create and save a new GPXDocument with one GPXTrack:
- create
GPXTrackWriterand add it as a location listener toLocationEngine. - set user parameters to
GPXTrackWriter.track(e.g.GPXTrack.nameorGPXTrack.description). - when writing is completed, create a new
GPXDocumentwith a list of oneGPXTrackand save the document viaGPXDocument.save(...).
A user wants to modify and save GPXTrack in the existing GPXDocument:
- load
GPXDocumentfrom a file by the relevant constructor. - create
GPXTrackWriterwith the required track in the listGPXDocument.tracks, add the created instance as a location listener toLocationEngine. - when writing is completed, save the document via
GPXDocument.save(...).
The GPXDocument including all tracks is saved in the GPX file format. Hence, once saved, it can be easily shared with other applications that understand the GPX file format.
-
Creates a new instance of GPXTrackWriter with an empty track inside.
Declaration
Swift
public init() -
GPX track into which GPX track points are written.
Declaration
Swift
public var track: GPXTrack { get } -
Called each time a new location is available. In a navigation context while using the
NavigatororVisualNavigator, it’s required to set theLocation.timeparameter for eachLocationobject so that the HERE SDK can map-match the locations properly. If theLocation.timeparameter is missing, the location will be ignored. For navigation, it is also recommended to provide thebearingandspeedparameters for eachLocationobject. Invoked on the main thread.Declaration
Swift
public func onLocationUpdated(_ location: Location)Parameters
locationCurrent location.