From 630ef001cc8af4f2253a6a625a7879052d35a1ca Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Tue, 12 May 2020 22:07:59 -0700 Subject: [PATCH] Update to latest GPS version. --- fgs/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fgs/views.py b/fgs/views.py index 2302358..6025f61 100644 --- a/fgs/views.py +++ b/fgs/views.py @@ -3,7 +3,7 @@ from .jwt import jwt_required from .model import * from flask import g, jsonify, request, abort from sqlalchemy import func -import geopy.distance +from geopy.distance import geodesic from datetime import datetime, timedelta @app.route('/') @@ -49,11 +49,11 @@ def collars_distance(): distance_kilometers = 0 coords_pairs = list(map(lambda e : (e.longitude, e.latitude), coords)) - if len(coord_pairs) < 1: continue + if len(coords_pairs) < 1: continue coord_last = coords_pairs.pop(0) for coord in coords_pairs: - distance_kilometers += geopy.distance.VincentyDistance(coord_last,coord).km + distance_kilometers += geodesic(coord_last,coord).km coord_last = coord active_collars.append(