-
-
Notifications
You must be signed in to change notification settings - Fork 57
How To: Deal with Extensions
Vincent Neo edited this page Feb 19, 2021
·
1 revision
Extensions in GPX files are represented as GPXExtensions
in CoreGPX.
Once a GPX file is parsed, you can access the extensions, by using subscript, with the tag name.
- Use
extensions["tagNameHere"]
to get aGPXExtensionElement
, which will contain various data parsed. Alternatively, useget(from parent: String?)
to get a dictionary of extension data parsed.
- Firstly, initialize GPXRoot using
init(withExtensionAttributes:, schemaLocation:)
to initialize with extension schema information on the main gpx header tag. - Secondly, initialize GPXExtensions whenever needed, to be added to the GPXRoot/or other elements, when needed.
- Use function
append(at parent: String?, contents: [String : String])
to write extension data. If no parent, usenil
.
To know more, please do read the documentation for GPXExtensions
and GPXExtensionsElement
.