-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfusion.py
executable file
·32 lines (28 loc) · 1.13 KB
/
fusion.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import ftclient as ft
class DataBase:
def __init__(self,tableid):
#self.token = ft.GoogleClientLogin(username,password)
self.token=""
self.client = ft.FTClient(self.token)
self.tableid = tableid
def idRequest(self,id):
#query = "select LOCATION_TYPE,ADDRESS,PHONE,ACCESSIBILITY_SHORT from "\
query = "select Facility Name, Address, Accessibility from "\
+str(self.tableid)+" where ID="+str(id)
header_data = self.client.runGetQuery(query)
data = header_data.partition('\n')[2]
return data
def nearbyRequest(self,latitude,longitude,service):
#query = "select LOCATION_TYPE,ADDRESS,PHONE,ACCESSIBILITY_SHORT from "\
lat = float(latitude)/1000000.0
lng = float(longitude)/1000000.0
#query = "select ADDRESS from "\
#query = "select LOCATION_TYPE,ADDRESS,PHONE,ACCESSIBILITY_SHORT,LATITUDE,LONGITUDE from "\
query = "select Facility Name, Address, Accessibility, Latitude, Longitude from "\
+str(self.tableid)+" "\
+"order by ST_DISTANCE(ADDRESS, LATLNG("\
+str(lat)+", "+str(lng)+"))"\
+" limit 2"
header_data = self.client.runGetQuery(query)
data = header_data.partition('\n')[2]
return data