def location_filter(files_with_tags, location, radius):
    '''
    Get photos taken within the specified radius from a given point.
    '''
    on_location = dict()
    for f, tags in files_with_tags.items():
        if 'GPS GPSLatitude' in tags:
            try:
                lat = convert_to_decimal(str(tags['GPS GPSLatitude']))
                long = convert_to_decimal(str(tags['GPS GPSLongitude']))
            except ValueError:
                print('{0} has invalid gps info'.format(f))
            try:
                if haversine(lat, long, location['lat'], location['long']) < radius:
                    on_location[f] = tags
            except InvalidCoordinate:
                print('{0} has invalid gps info'.format(f))
    return on_location
def location_filter ( files_with_tags , location , radius ) : on_location = dict ( ) for f , tags in files_with_tags . items ( ) : if 'GPS GPSLatitude' in tags : try : lat = convert_to_decimal ( str ( tags [ 'GPS GPSLatitude' ] ) ) long = convert_to_decimal ( str ( tags [ 'GPS GPSLongitude' ] ) ) except ValueError : print ( '{0} has invalid gps info' . format ( f ) ) try : if haversine ( lat , long , location [ 'lat' ] , location [ 'long' ] ) < radius : on_location [ f ] = tags except InvalidCoordinate : print ( '{0} has invalid gps info' . format ( f ) ) return on_location
Get photos taken within the specified radius from a given point.