dockers/API/restV1.py
def location(range, commands):
    '''
    returns only rooms that are within a certain range (km) circle from CENTER
    '''

    calls = commands_parser(commands)
    data = get_where_json(calls)

    new_data = []
    for piece in data:
        dinstance = ((abs(piece['lat'] - CENTER[0]))**2 +
                     (abs(piece['lon']-CENTER[1]))**2)**0.5

        # 111 is the differnence between 1 km and 1 degree +-
        if (int(range) > dinstance*111):
            new_data.append(piece)

    return jsonify({"data": new_data}), 200

    returns only rooms that are within a certain range (km) circle from CENTER
    
returns only rooms that are within a certain range (km) circle from CENTER
returns only rooms that are within a certain range ( km ) circle from CENTER
def location(range, commands):
    calls = commands_parser(commands)
    data = get_where_json(calls)
    new_data = []
    for piece in data:
        dinstance = ((abs(piece['lat'] - CENTER[0]))**2 +
                     (abs(piece['lon']-CENTER[1]))**2)**0.5
        if (int(range) > dinstance*111):
            new_data.append(piece)
    return jsonify({"data": new_data}), 200
def location ( range , commands ) : calls = commands_parser ( commands ) data = get_where_json ( calls ) new_data = [ ] for piece in data : dinstance = ( ( abs ( piece [ 'lat' ] - CENTER [ 0 ] ) ) ** 2 + ( abs ( piece [ 'lon' ] - CENTER [ 1 ] ) ) ** 2 ) ** 0.5 if ( int ( range ) > dinstance * 111 ) : new_data . append ( piece ) return jsonify ( { "data" : new_data } ) , 200
returns only rooms that are within a certain range (km) circle from CENTER
returns only rooms that are within a certain range ( km ) circle from CENTER
'''
    returns only rooms that are within a certain range (km) circle from CENTER
    ''' # 111 is the differnence between 1 km and 1 degree +-
range
commands