GeoTIFF¶
async_geotiff.GeoTIFF
dataclass
¶
Bases: ReadMixin, FetchTileMixin, TransformMixin
A class representing a GeoTIFF image.
bounds
cached
property
¶
colormap
property
¶
colormap: Colormap | None
Return the Colormap stored in the file, if any.
Returns:
-
Colormap | None–A Colormap instance if the dataset has a colormap, else None.
compression
property
¶
compression: Compression | None
The compression algorithm used for the dataset.
Returns None if the compression is not recognized.
dtype
property
¶
dtype: dtype | None
The NumPy data type of the image.
Returns None if the data type is unknown/not supported.
overviews
property
¶
A list of overview levels for the dataset.
Overviews are reduced-resolution versions of the main image used for faster rendering at lower zoom levels.
This list of overviews is ordered from finest to coarsest resolution. The first element of the list is the highest-resolution after the base image.
photometric
property
¶
photometric: PhotometricInterpretation | None
The photometric interpretation of the dataset.
Returns None if the photometric interpretation is not recognized.
res
property
¶
Return the (width, height) of pixels in the units of its CRS.
transform
property
¶
transform: Affine
Return the dataset's georeferencing transformation matrix.
This transform maps pixel row/column coordinates to coordinates in the dataset's CRS.
fetch_tiles
async
¶
index ¶
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:
open
async
classmethod
¶
open(
path: str,
*,
store: ObspecInput,
prefetch: int = 32768,
multiplier: float = 2.0
) -> Self
Open a new GeoTIFF.
Parameters:
-
path(str) –The path within the store to read from.
-
store(ObspecInput) –The backend to use for data fetching.
-
prefetch(int, default:32768) –The number of initial bytes to read up front.
-
multiplier(float, default:2.0) –The multiplier to use for readahead size growth. Must be greater than 1.0. For example, for a value of
2.0, the first metadata read will be of sizeprefetch, and then the next read will be of sizeprefetch * 2.
Returns:
-
Self–A GeoTIFF instance.
read
async
¶
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:
-
Array–An Array 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: