File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -78,17 +78,22 @@ def load_gpx(self, gpx_url: str):
7878 self .get_points (self .gpx )
7979 return self .gpx
8080
81- def get_points (self ,gpx ):
81+ def get_points (self ,gpx , way_points_fallback : bool = False ):
8282 """
8383 get the points for the given gpx track
8484 """
8585 self .points = []
86+ # routes
87+ for route in gpx .routes :
88+ for point in route .points :
89+ self .points .append ((point .latitude , point .longitude ))
90+ # tracks
8691 for track in gpx .tracks :
8792 for segment in track .segments :
8893 for point in segment .points :
8994 self .points .append ((point .latitude , point .longitude ))
90- # Handle waypoints if no track points were found
91- if not self .points and gpx .waypoints :
95+ # Handle waypoints if no points were found and fallback is active
96+ if not self .points and gpx .waypoints and way_points_fallback :
9297 for waypoint in gpx .waypoints :
9398 self .points .append ((waypoint .latitude , waypoint .longitude ))
9499
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class TestGPXViewer(Basetest):
1313 test GPXViewer
1414 """
1515
16- def setUp (self , debug = False , profile = True ):
16+ def setUp (self , debug = True , profile = True ):
1717 Basetest .setUp (self , debug = debug , profile = profile )
1818
1919 def test_gpx_viewer (self ):
@@ -22,7 +22,7 @@ def test_gpx_viewer(self):
2222 """
2323 expected_centers = {
2424 list (GPXViewer .samples .keys ())[0 ]: # Mountain bike loop at Middlesex Fells reservation.
25- (42.434853 , - 71.114787 )
25+ (42.44903 , - 71.1139805 )
2626 }
2727 for sample_name , gpx_url in GPXViewer .samples .items ():
2828 with self .subTest (sample_name = sample_name ):
You can’t perform that action at this time.
0 commit comments