Update to latest GPS version.
This commit is contained in:
parent
7d3138c48f
commit
630ef001cc
|
@ -3,7 +3,7 @@ from .jwt import jwt_required
|
||||||
from .model import *
|
from .model import *
|
||||||
from flask import g, jsonify, request, abort
|
from flask import g, jsonify, request, abort
|
||||||
from sqlalchemy import func
|
from sqlalchemy import func
|
||||||
import geopy.distance
|
from geopy.distance import geodesic
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
|
@ -49,11 +49,11 @@ def collars_distance():
|
||||||
|
|
||||||
distance_kilometers = 0
|
distance_kilometers = 0
|
||||||
coords_pairs = list(map(lambda e : (e.longitude, e.latitude), coords))
|
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)
|
coord_last = coords_pairs.pop(0)
|
||||||
for coord in coords_pairs:
|
for coord in coords_pairs:
|
||||||
distance_kilometers += geopy.distance.VincentyDistance(coord_last,coord).km
|
distance_kilometers += geodesic(coord_last,coord).km
|
||||||
coord_last = coord
|
coord_last = coord
|
||||||
|
|
||||||
active_collars.append(
|
active_collars.append(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user