Skip to content

Commit

Permalink
Merge pull request #31 from kaueraal/master
Browse files Browse the repository at this point in the history
Added support for <desc> in waypoints
  • Loading branch information
mpetazzoni committed Mar 16, 2016
2 parents fd7d0b2 + 21cc616 commit 915f318
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion gpx.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ L.GPX = L.FeatureGroup.extend({
<ele>8.832767</ele>
<time>2015-08-16T11:34:54Z</time>
<name>START3</name>
<desc>Some point</desc>
<sym>Pin, Blue</sym>
<type>user</type>
</wpt>
Expand All @@ -319,6 +320,12 @@ L.GPX = L.FeatureGroup.extend({
name = nameEl[0].textContent;
}

var descEl = el[i].getElementsByTagName('desc');
desc = '';
if (descEl.length > 0) {
desc = descEl[0].textContent;
}

var symEl = el[i].getElementsByTagName('sym');
var symKey = '';
if (symEl.length > 0) {
Expand All @@ -332,7 +339,7 @@ L.GPX = L.FeatureGroup.extend({
title: name,
icon: symIcon ? new L.GPXTrackIcon({iconUrl: symIcon}) : new L.Icon.Default()
});
marker.bindPopup("<b>" + name + "</b>").openPopup();
marker.bindPopup("<b>" + name + "</b>" + (desc.length > 0 ? '<br>' + desc : '')).openPopup();
this.fire('addpoint', {point: marker});
layers.push(marker);
}
Expand Down

0 comments on commit 915f318

Please sign in to comment.