summaryrefslogtreecommitdiff
path: root/app/utils/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/utils/util.py')
-rw-r--r--app/utils/util.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/utils/util.py b/app/utils/util.py
new file mode 100644
index 0000000..3da6d06
--- /dev/null
+++ b/app/utils/util.py
@@ -0,0 +1,15 @@
+from daily.models import CheckIn
+from django.contrib.gis.geos import GEOSGeometry
+
+
+def convertll(lat, lon):
+ pnt = GEOSGeometry('POINT({0} {1})'.format(lon, lat), srid=4326)
+ pnt.transform(3857)
+ return pnt.y, pnt.x
+
+
+def get_latlon():
+ loc = CheckIn.objects.latest()
+ lat_converted, lon_converted = convertll(loc.lat, loc.lon)
+ return lat_converted, lon_converted
+