Skip to content

Overview

async_geotiff.Overview dataclass

An overview level of a Cloud-Optimized GeoTIFF image.

block_shapes property

block_shapes: tuple[tuple[int, int], ...]

Block shapes for each band. Each shape is (height, width).

bounds property

bounds: BoundingBox

Return the bounds of the dataset in the units of its CRS.

Returns:

  • BoundingBox ( BoundingBox ) –

    The bounding box of the dataset.

count property

count: int

The number of bands in the overview.

crs property

crs: CRS

The coordinate reference system of the overview.

height property

height: int

The height of the overview in pixels.

ifd instance-attribute

Access to the underlying ImageFileDirectory of this overview level.

Warning

This is for advanced users who need access to the underlying TIFF object. Most users should only need to use async-geotiff's higher-level APIs.

mask_ifd instance-attribute

mask_ifd: ImageFileDirectory | None

Access to the underlying ImageFileDirectory for the mask associated with this overview level, if any.

Warning

This is for advanced users who need access to the underlying TIFF object. Most users should only need to use async-geotiff's higher-level APIs.

nodata property

nodata: int | float | None

The nodata value for the overview, if any.

res property

res: tuple[float, float]

Return the (width, height) of pixels in the units of its CRS.

shape property

shape: tuple[int, int]

Get the shape (height, width) of the overview.

tile_count property

tile_count: tuple[int, int]

The number of tiles in the x and y directions.

tile_height property

tile_height: int

The height in pixels per tile of the overview.

tile_width property

tile_width: int

The width in pixels per tile of the overview.

transform property

transform: Affine

The affine transform mapping pixel coordinates to geographic coordinates.

Returns:

  • Affine ( Affine ) –

    The affine transform.

width property

width: int

The width of the overview in pixels.

fetch_tile async

fetch_tile(x: int, y: int, *, boundless: bool = True) -> Tile

Fetch a single tile from the GeoTIFF.

Parameters:

  • x (int) –

    The x-coordinate of the tile.

  • y (int) –

    The y-coordinate of the tile.

Other Parameters:

  • boundless (bool) –

    If False, clip edge tiles to the image bounds. Defaults to True.

Returns:

  • Tile

    A Tile object containing the fetched tile data.

fetch_tiles async

fetch_tiles(
    xy: Sequence[tuple[int, int]], *, boundless: bool = True
) -> list[Tile]

Fetch multiple tiles from this overview.

The benefit of using this method over multiple calls to fetch_tile is that fetch_tiles will coalesce requests for tiles that are stored contiguously on disk. The exact behavior depends on how the underlying store passed to GeoTIFF.open implements get_ranges_async.

Parameters:

Other Parameters:

  • boundless (bool) –

    If False, clip edge tiles to the image bounds.

index

index(
    x: float, y: float, op: Callable[[float], int] = floor
) -> tuple[int, int]

Get the (row, col) index of the pixel containing (x, y).

Parameters:

  • x (float) –

    x value in coordinate reference system.

  • y (float) –

    y value in coordinate reference system.

  • op (Callable[[float], int], default: floor ) –

    Function to convert fractional pixels to whole numbers (floor, ceiling, round). Defaults to math.floor.

Returns:

read async

read(*, window: Window | None = None) -> RasterArray

Read pixel data for a window region.

This method fetches all tiles that intersect the given window and stitches them together, returning only the pixels within the window.

Parameters:

  • window (Window | None, default: None ) –

    A Window object defining the pixel region to read. If None, the entire image is read.

Returns:

  • RasterArray

    A RasterArray containing the pixel data for the requested window.

Raises:

  • WindowError

    If the window extends outside the image bounds.

xy

xy(
    row: int,
    col: int,
    offset: Literal["center", "ul", "ur", "ll", "lr"] = "center",
) -> tuple[float, float]

Get the coordinates (x, y) of a pixel at (row, col).

The pixel's center is returned by default, but a corner can be returned by setting offset to one of "ul", "ur", "ll", "lr".

Parameters:

  • row (int) –

    Pixel row.

  • col (int) –

    Pixel column.

  • offset (Literal['center', 'ul', 'ur', 'll', 'lr'], default: 'center' ) –

    Determines if the returned coordinates are for the center of the pixel or for a corner.

Returns: