forked from expo/troggle
25 lines
676 B
Python
25 lines
676 B
Python
import utm
|
|
import math
|
|
from django.conf import settings
|
|
|
|
def lat_lon_entrance(utmstring):
|
|
try:
|
|
x = float(utmstring.split()[0])
|
|
y = float(utmstring.split()[1])
|
|
#return ' '+str(x+y)+' '+str(y)
|
|
q = utm.to_latlon(x, y, 33, 'U')
|
|
return "{:.5f} {:.5f}".format(q[0],q[1])
|
|
except:
|
|
return 'Not found'
|
|
|
|
def top_camp_distance(utmstring):
|
|
try:
|
|
x = float(utmstring.split()[0])
|
|
y = float(utmstring.split()[1])
|
|
tx = settings.TOPCAMPX
|
|
ty = settings.TOPCAMPY
|
|
dist = math.sqrt( (tx-x)*(tx-x) + (ty-y)*(ty-y) )
|
|
return "{:.1f}".format(dist)
|
|
except:
|
|
return 'Not found'
|