def test_verify_low_seed_tiles(self): from tilequeue.tile import coord_int_zoom_up from tilequeue.tile import coord_marshall_int from tilequeue.tile import seed_tiles seed_coords = seed_tiles(1, 5) for coord in seed_coords: coord_int = coord_marshall_int(coord) parent_coord = coord.zoomTo(coord.zoom - 1).container() exp_int = coord_marshall_int(parent_coord) act_int = coord_int_zoom_up(coord_int) self.assertEquals(exp_int, act_int)
def explode_and_intersect(coord_ints, tiles_of_interest, until=0): next_coord_ints = coord_ints coord_ints_at_parent_zoom = set() while True: for coord_int in next_coord_ints: if coord_int in tiles_of_interest: yield coord_int zoom = zoom_mask & coord_int if zoom > until: parent_coord_int = coord_int_zoom_up(coord_int) coord_ints_at_parent_zoom.add(parent_coord_int) if not coord_ints_at_parent_zoom: return next_coord_ints = coord_ints_at_parent_zoom coord_ints_at_parent_zoom = set()
def test_verify_examples(self): from ModestMaps.Core import Coordinate from tilequeue.tile import coord_int_zoom_up from tilequeue.tile import coord_marshall_int test_coords = ( Coordinate(zoom=20, column=1002463, row=312816), Coordinate(zoom=20, column=(2 ** 20)-1, row=(2 ** 20)-1), Coordinate(zoom=10, column=(2 ** 10)-1, row=(2 ** 10)-1), Coordinate(zoom=5, column=20, row=20), Coordinate(zoom=1, column=0, row=0), ) for coord in test_coords: coord_int = coord_marshall_int(coord) parent_coord = coord.zoomTo(coord.zoom - 1).container() exp_int = coord_marshall_int(parent_coord) act_int = coord_int_zoom_up(coord_int) self.assertEquals(exp_int, act_int)