GPXDocument
public class GPXDocument
extension GPXDocument: NativeBase
extension GPXDocument: Hashable
Use the GPXDocument to load the GPX file. Only track data is used from the GPX file format (see trkType at https://www.topografix.com/GPX/1/1/#type_trkType). Any unknown elements in the file are ignored. Any known element with an invalid value returns an error. Elevation values are ignored.
-
Create a GPX document from a file.
Throws
InstantiationErrorIndicates what went wrong when the instantiation was attempted.Declaration
Swift
public init(gpxFilePath: String, options: GPXOptions) throwsParameters
gpxFilePathThe path to the GPX file.
optionsThe options to customize reading.
-
Create a GPX document from a list of GPX tracks.
Declaration
Swift
public init(tracks: [GPXTrack])Parameters
tracksThe list of tracks.
-
The tracks stored in this GPX document.
Declaration
Swift
public var tracks: [GPXTrack] { get } -
Create a GPX document from a string.
Throws
InstantiationErrorIndicates what went wrong when the instantiation was attempted.Declaration
Swift
public static func fromString(content: String, options: GPXOptions) throws -> GPXDocumentParameters
contentThe content of a GPX file as string.
optionsThe options to customize reading.
Return Value
An
GPXDocumentinstance. -
Saves the document to a file. For saving the
GPXDocument.tracksmodification before writing to a file, useGPXTrackWriter.Declaration
Swift
public func save(gpxFilePath: String) -> BoolParameters
gpxFilePathThe file path where the GPX document will be saved.
Return Value
Trueif the document has been saved successfully.Falseif an error has been happened during saving. -
Add track to GPX document.
Declaration
Swift
public func addTrack(trackToAdd: GPXTrack)Parameters
trackToAddtrack to add to GPX document