summaryrefslogtreecommitdiff
path: root/app/utils/util.py
blob: 3da6d066aa7089d38ba689377dd631589bff2bf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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