From 728d4a4d6cafaa2cb78a7085db75ca560b1fc286 Mon Sep 17 00:00:00 2001 From: agrath Date: Mon, 6 Nov 2017 11:51:28 +1300 Subject: [PATCH 1/2] Return polyline and marker objects --- loadgpx.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/loadgpx.js b/loadgpx.js index eaef8fa..96c662b 100644 --- a/loadgpx.js +++ b/loadgpx.js @@ -131,6 +131,8 @@ GPXParser.prototype.createMarker = function(point) { google.maps.event.addListener(marker, "click", function() { infowindow.open(this.map, marker); }); + + return { marker: marker, infowindow: infowindow }; } GPXParser.prototype.addTrackSegmentToMap = function(trackSegment, colour, @@ -171,6 +173,7 @@ GPXParser.prototype.addTrackSegmentToMap = function(trackSegment, colour, strokeWeight: width, map: this.map }); + return polyline; } GPXParser.prototype.addTrackToMap = function(track, colour, width) { From 40cc68edf454a26ce3e6e6dfa9c943648bfe632e Mon Sep 17 00:00:00 2001 From: agrath Date: Mon, 6 Nov 2017 11:53:53 +1300 Subject: [PATCH 2/2] Update loadgpx.js --- loadgpx.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/loadgpx.js b/loadgpx.js index 96c662b..a9f5839 100644 --- a/loadgpx.js +++ b/loadgpx.js @@ -178,10 +178,13 @@ GPXParser.prototype.addTrackSegmentToMap = function(trackSegment, colour, GPXParser.prototype.addTrackToMap = function(track, colour, width) { var segments = track.getElementsByTagName("trkseg"); + var result = []; for(var i = 0; i < segments.length; i++) { - var segmentlatlngbounds = this.addTrackSegmentToMap(segments[i], colour, + var polyline = this.addTrackSegmentToMap(segments[i], colour, width); + result.push(polyline); } + return result; } GPXParser.prototype.addRouteToMap = function(route, colour, width) {