Skip to content

Commit

Permalink
feat: add garmin extension handling
Browse files Browse the repository at this point in the history
  • Loading branch information
hansemannn authored and tmcw committed Dec 29, 2019
1 parent 1a31d68 commit 2e95798
Show file tree
Hide file tree
Showing 7 changed files with 7,673 additions and 265 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
dist
node_modules/
npm-debug.log
/.nyc_output
12 changes: 12 additions & 0 deletions lib/gpx.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ function getProperties(node) {
"time",
"keywords"
]);
// Parse additional data from our Garmin extension(s)
const extensions = get1(node, "extensions");
if (extensions) {
const routeExtension = get1(extensions, "gpxx:RouteExtension");
if (routeExtension) {
const displayColor = nodeVal(get1(routeExtension, "gpxx:DisplayColor"));
const isAutoNamed = nodeVal(get1(routeExtension, "gpxx:IsAutoNamed"));

prop["gpxx-display-color"] = displayColor;
prop["gpxx-is-auto-named"] = isAutoNamed === "true";
}
}
const links = node.getElementsByTagName("link");
if (links.length) prop.links = [];
for (let i = 0; i < links.length; i++) {
Expand Down

0 comments on commit 2e95798

Please sign in to comment.