From 40939853e11766abbd2976c076af3f1d72f6d206 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Sun, 8 Mar 2020 11:35:29 -0400 Subject: fixed a bug in GPX Track creator --- app/locations/models.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/app/locations/models.py b/app/locations/models.py index 6f598b2..bab2c15 100644 --- a/app/locations/models.py +++ b/app/locations/models.py @@ -451,19 +451,16 @@ def parse_gpx(gpx_obj, gpx_data): if gpx.tracks: for track in gpx.tracks: print("track name:" +str(track.name)) - new_track = GPXTrack() for segment in track.segments: - track_list_of_points = [] for point in segment.points: - point_in_segment = Point(point.longitude, point.latitude) track_list_of_points.append(point_in_segment.coords) - new_track_segment = LineString(track_list_of_points) - - new_track.track = MultiLineString(new_track_segment) - new_track.gpx_file = gpx_obj + new_track = GPXTrack.objects.create( + gpx_file = gpx_obj, + track = MultiLineString(new_track_segment) + ) new_track.save() -- cgit v1.2.3-70-g09d2