コード例 #1
0
def test_pixel_bounds_chicago(chicago_quad_tree, chicago_pixel_bounds):
    tile = Tile.from_quad_tree(chicago_quad_tree)

    point_min, point_max = tile.bounds

    assert chicago_pixel_bounds[0] == point_min.pixels(zoom=tile.zoom)
    assert chicago_pixel_bounds[1] == point_max.pixels(zoom=tile.zoom)
コード例 #2
0
def test_cross_check(tms, google, quad_tree, zoom):
    tile = Tile.from_quad_tree(quad_tree=quad_tree)

    assert tile.tms == tms
    assert tile.zoom == zoom
    assert tile.google == google
    assert tile.quad_tree == quad_tree
コード例 #3
0
def tile_to_geo_boundary(key):

    a = Tile.from_quad_tree(key)
    return ("Polygon ((" + f"{a.bounds[0].longitude}" + " " +
            f"{a.bounds[0].latitude}" + "," + f"{a.bounds[0].longitude}" +
            " " + f"{a.bounds[1].latitude}" + "," +
            f"{a.bounds[1].longitude}" + " " + f"{a.bounds[1].latitude}" +
            "," + f"{a.bounds[1].longitude}" + " " +
            f"{a.bounds[0].latitude}" + "," + f"{a.bounds[0].longitude}" +
            " " + f"{a.bounds[0].latitude}" + "))")
コード例 #4
0
def tile_get_resolution(key):

    return Tile.from_quad_tree(key).zoom
コード例 #5
0
 def tile_bounds(self, qk):
     t = Tile.from_quad_tree('{}'.format(qk)) # tile from a quad tree repr string
     bounds = t.bounds
     return bounds
コード例 #6
0
def test_from_quad_tree(tms, quad_tree, zoom):
    tile = Tile.from_quad_tree(quad_tree=quad_tree)

    assert tile.tms == tms
    assert tile.zoom == zoom
コード例 #7
0
def test_no_assert_quad_tree(quad_tree):
    _ = Tile.from_quad_tree(quad_tree=quad_tree)
    assert "No assertion raise :)"
コード例 #8
0
def test_assert_quad_tree(quad_tree):
    with pytest.raises(AssertionError) as assertion_info:
        _ = Tile.from_quad_tree(quad_tree=quad_tree)

    assert 'QuadTree value can only consists of the digits 0, 1, 2 and 3.' in str(
        assertion_info.value)