Ejemplo n.º 1
0
    def get_shop_ids_by_location_geo_hashed(self, lat, long, range):

        # hash for the current location
        geo_hash = geohash.encode(lat, long, self.hash_size)

        # amount of rectangles around the geo_hash depending on the radius
        levels = int(range / 500)

        # gets the grid of geo hashes thay concerns the radius
        surroundings_hashes = get_surroundings_grid(geo_hash, levels)
        shops = self.shops_repository.get_shops_by_geohashes(surroundings_hashes)

        # refine search with brute force to increase accuracy, within the subset
        shopsfiltered = self.filter_brute_force(lat, long, range, shops)

        return shopsfiltered
Ejemplo n.º 2
0
    def get_shop_ids_by_location_geo_hashed(self, lat, long, range):

        # hash for the current location
        geo_hash = geohash.encode(lat, long, self.hash_size)

        # amount of rectangles around the geo_hash depending on the radius
        levels = int(range / 500)

        # gets the grid of geo hashes thay concerns the radius
        surroundings_hashes = get_surroundings_grid(geo_hash, levels)
        shops = self.shops_repository.get_shops_by_geohashes(
            surroundings_hashes)

        # refine search with brute force to increase accuracy, within the subset
        shopsfiltered = self.filter_brute_force(lat, long, range, shops)

        return shopsfiltered
Ejemplo n.º 3
0
def test_get_shops_dictionary_hashed_1000radius_should_be_25():
    result = get_surroundings_grid("u6sc9f", 2)
    assert len(result) == 25