summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-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()