示例#1
0
文件: Vote.py 项目: bencochran/gnarly
def AddingToFood(req, lat='0', lon='0', maxDistance='10000'):
    #Returns all the Food landmarks within a radius of the given position
    db = gnarusServer.getConnection()
    lat, lon, maxDistance = gnarusServer.processVariables(lat, lon, maxDistance)
    query = "SELECT landmarkTable.id, landmarkTable.name, landmarkTable.latitude, landmarkTable.longitude, GeoDistM(landmarkTable.latitude, landmarkTable.longitude, %f, %f) as distance, Food.summary, Food.menu, Food.hours, Food.description, Food.imageURL From landmarkTable JOIN Food where landmarkTable.id = Food.landmarkID GROUP BY landmarkTable.id HAVING distance <=%d ORDER BY distance ASC" %(lat, lon, maxDistance)
    answer = gnarusServer.processQuery(db, query)
    return answer
示例#2
0
文件: Vote.py 项目: bencochran/gnarly
def AddingToSportingArenas(req, lat='0', lon='0', maxDistance='10000'):
    #Retunrs all the Sports landmarks within a radius of the given position
    db = gnarusServer.getConnection()
    lat, lon, maxDistance = gnarusServer.processVariables(lat, lon, maxDistance)
    query = "SELECT landmarkTable.id, landmarkTable.name, landmarkTable.latitude, landmarkTable.longitude, GeoDistM(landmarkTable.latitude, landmarkTable.longitude, %f, %f) as distance, SportingArenas.summary, SportingArenas.imageURL, SportingArenas.scheduleURL, SportingArenas.usedBy From landmarkTable JOIN SportingArenas where landmarkTable.id = SportingArenas.landmarkID GROUP BY landmarkTable.id HAVING distance <=%d ORDER BY distance ASC" %(lat, lon, maxDistance)
    answer = gnarusServer.processQuery(db, query)
    return answer