Beispiel #1
0
def test_tile_invalid_bounds():
    """Should raise an error with invalid tile."""
    tile_z = 19
    tile_x = 554
    tile_y = 200458

    with pytest.raises(TileOutsideBounds):
        cogeo.tile(ADDRESS, tile_x, tile_y, tile_z)
Beispiel #2
0
def test_tile_valid_default():
    """Should return a 3 bands array and a full valid mask."""
    tile_z = 21
    tile_x = 438217
    tile_y = 801835

    data, mask = cogeo.tile(ADDRESS, tile_x, tile_y, tile_z)
    assert data.shape == (3, 256, 256)
    assert mask.all()
Beispiel #3
0
def get_city_tile(opts={}):
    """ Return tile for city on date """
    city = opts.get('city')
    zoom = opts.get('zoom')
    city_tile = mercantile.tile(latlons[city]['lon'], latlons[city]['lat'], zoom)
    tile_url = get_tile_url(opts)
    tile, mask = cogeo.tile(
        tile_url,
        city_tile.x,  # mercator tile X value (arbitrary map tile location within the source image)
        city_tile.y,  # mercator tile Y value
        zoom,  # mercator tile Z value
        tilesize=256
    )
    return tile