summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2020-03-08 11:35:29 -0400
committerluxagraf <sng@luxagraf.net>2020-03-08 11:35:29 -0400
commit40939853e11766abbd2976c076af3f1d72f6d206 (patch)
tree9f662a2aba1b81a34cc2e70d15ab3317f6e036be
parent2f80394a309e01f4a77dc4b1094b7185033c6757 (diff)
fixed a bug in GPX Track creator
-rw-r--r--app/locations/models.py11
1 files 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()