Update to latest GPS version.

This commit is contained in:
Danila Fedorin 2020-05-12 22:07:59 -07:00
parent 7d3138c48f
commit 630ef001cc

View File

@ -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(