def trip_length_and_duration(file_name): duration = timedelta(seconds=0) open(file_name, 'r') gpx = GPX(open(file_name)) distance = gpx.distance() duration = gpx.duration() return distance, duration.seconds
def main(): """A simple example application""" if len(sys.argv) != 2: print "Usage: %s filename" % sys.argv[0] return gpx = GPX(open(sys.argv[1])) for trk in gpx.tracks: print trk.distance() / 1000.0, trk.duration(), \ trk.full_duration(), trk.start_time(), trk.end_time()
def test_length(self): gpx = GPX(open('tests/test_data/2012_06_30 21_17.gpx', 'r')) d = gpx.distance() d_calculated = 6000 self.assertAlmostEqual(d, d_calculated, delta=100)
def test_length(self): gpx = GPX(open("tests/test_data/2012_06_30 21_17.gpx", "r")) d = gpx.distance() d_calculated = 6000 self.assertAlmostEqual(d, d_calculated, delta=100)