dart-gpx icon indicating copy to clipboard operation
dart-gpx copied to clipboard

adding garmin extensions

Open Sprechen opened this issue 1 year ago • 2 comments

I need to add information to my trk infos, specifically I need to add the speed of each point in the segment. This is defined by the garmin extension https://www8.garmin.com/xmlschemas/TrackPointExtensionv2.xsd. As I understand, for each point I can use the extensions map to add additional data for each Wpt point, but how I can add schemas to the Gpx node?

Sprechen avatar May 09 '24 09:05 Sprechen

It's possible to use GpxWriter().asXml. For ex.:

final gpxXml = GpxWriter().asXml(gpx);
gpxXml.children[1].setAttribute("xmlns:trp", "http://www.garmin.com/xmlschemas/TripExtensions/v1");
gpxXml.children[1].setAttribute("xsi:schemaLocation", "http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd");
gpxXml.toXmlString()

kb0 avatar May 09 '24 11:05 kb0

It's possible to use GpxWriter().asXml. For ex.:

final gpxXml = GpxWriter().asXml(gpx);
gpxXml.children[1].setAttribute("xmlns:trp", "http://www.garmin.com/xmlschemas/TripExtensions/v1");
gpxXml.children[1].setAttribute("xsi:schemaLocation", "http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd");
gpxXml.toXmlString()

Ok thank you! So, no native support for that! Maybe, I can make a pull request with this feature

Sprechen avatar May 09 '24 14:05 Sprechen