mirror of
https://github.com/nikdoof/vapemap.git
synced 2025-12-14 06:42:17 +00:00
Remove unneeded function.
This commit is contained in:
@@ -1,25 +1,8 @@
|
|||||||
from math import radians, cos, sin, asin, sqrt
|
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from geopy.geocoders import GoogleV3
|
from geopy.geocoders import GoogleV3
|
||||||
from geopy.geocoders.base import GeocoderResultError
|
from geopy.geocoders.base import GeocoderResultError
|
||||||
|
|
||||||
|
|
||||||
def haversine(lon1, lat1, lon2, lat2):
|
|
||||||
"""
|
|
||||||
Calculate the great circle distance between two points
|
|
||||||
on the earth (specified in decimal degrees)
|
|
||||||
"""
|
|
||||||
# convert decimal degrees to radians
|
|
||||||
lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2])
|
|
||||||
# haversine formula
|
|
||||||
dlon = lon2 - lon1
|
|
||||||
dlat = lat2 - lat1
|
|
||||||
a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2
|
|
||||||
c = 2 * asin(sqrt(a))
|
|
||||||
km = 6367 * c
|
|
||||||
return km
|
|
||||||
|
|
||||||
|
|
||||||
def caching_geo_lookup(address):
|
def caching_geo_lookup(address):
|
||||||
"""
|
"""
|
||||||
Preforms a geo lookup against Google V3 and caches the results
|
Preforms a geo lookup against Google V3 and caches the results
|
||||||
|
|||||||
Reference in New Issue
Block a user