Esempio n. 1
0
def test_Extent_fromTile():
    # fun func
    ext = Extent.fromTile(xi=1062, yi=693, zoom=11)

    assert np.isclose(ext.xMin, 743579.411158)
    assert np.isclose(ext.xMax, 763147.290399)
    assert np.isclose(ext.yMin, 6457400.149532)
    assert np.isclose(ext.yMax, 6476968.028773)
Esempio n. 2
0
def test_Extent_subTiles():
    ext = Extent.fromVector(_test_data_['aachenShapefile.shp'])

    tiles = [Extent.fromTile(t.xi, t.yi, t.zoom) for t in ext.subTiles(9)]

    assert len(tiles) == 4

    assert np.isclose(tiles[0].xMin, 626172.135712)
    assert np.isclose(tiles[0].xMax, 704443.652676)
    assert np.isclose(tiles[0].yMin, 6574807.424978)
    assert np.isclose(tiles[0].yMax, 6653078.941942)
    assert tiles[0].srs.IsSame(srs.EPSG3857)

    assert np.isclose(tiles[1].xMin, 626172.135712)
    assert np.isclose(tiles[1].xMax, 704443.652676)
    assert np.isclose(tiles[1].yMin, 6496535.908014)
    assert np.isclose(tiles[1].yMax, 6574807.424978)
    assert tiles[1].srs.IsSame(srs.EPSG3857)

    assert np.isclose(tiles[2].xMin, 704443.652676)
    assert np.isclose(tiles[2].xMax, 782715.169640)
    assert np.isclose(tiles[2].yMin, 6574807.424978)
    assert np.isclose(tiles[2].yMax, 6653078.941942)
    assert tiles[2].srs.IsSame(srs.EPSG3857)

    assert np.isclose(tiles[3].xMin, 704443.652676)
    assert np.isclose(tiles[3].xMax, 782715.169640)
    assert np.isclose(tiles[3].yMin, 6496535.908014)
    assert np.isclose(tiles[3].yMax, 6574807.424978)
    assert tiles[3].srs.IsSame(srs.EPSG3857)

    tiles = list(ext.subTiles(10))
    assert len(tiles) == 9

    tiles = list(ext.subTiles(11))
    assert len(tiles) == 20

    tiles = list(ext.subTiles(12))
    assert len(tiles) == 63