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