Skip to content

rio_tiler.experimental.geotiff

rio_tiler.experimental.geotiff

rio_tiler.experimental.geotiff reader: rio-tiler Async reader built on top of async-geotiff.

Reader

Bases: AsyncBaseReader

Rio-tiler.io GeoTIFFReader.

maxzoom property

maxzoom

Return dataset maxzoom.

minzoom property

minzoom

Return dataset minzoom.

__aenter__ async

__aenter__()

Support using with Context Managers.

__aexit__ async

__aexit__(exc_type, exc_value, traceback)

Support using with Context Managers.

__attrs_post_init__

__attrs_post_init__()

Post init.

_get_overview_level

_get_overview_level(target_res: float, zoom_level_strategy: Literal['AUTO', 'LOWER', 'UPPER'] = 'AUTO') -> int

Return the overview level corresponding to the resolution.

_read async

_read(dataset: GeoTIFF | Overview, indexes: Sequence[int] | None = None, window: Window | None = None, unscale: bool = False) -> ImageData

Reader Data from GeoTIFF or Overview.

feature async

feature(shape: dict, dst_crs: CRS | None = None, shape_crs: CRS = WGS84_CRS, indexes: Indexes | None = None, expression: str | None = None, max_size: int | None = None, height: int | None = None, width: int | None = None, **kwargs: Any) -> ImageData

Read a Dataset for a GeoJSON feature.

Parameters:

  • shape (dict) –

    Valid GeoJSON feature.

  • dst_crs (CRS, default: None ) –

    Overwrite target coordinate reference system.

  • shape_crs (CRS, default: WGS84_CRS ) –

    Input geojson coordinate reference system. Defaults to epsg:4326.

  • indexes (sequence of int or int, default: None ) –

    Band indexes.

  • expression (str, default: None ) –

    rio-tiler expression (e.g. b1/b2+b3).

  • max_size (int, default: None ) –

    Limit the size of the longest dimension of the dataset read, respecting bounds X/Y aspect ratio.

  • height (int, default: None ) –

    Output height of the array.

  • width (int, default: None ) –

    Output width of the array.

  • **kwargs (Any, default: {} ) –

    Any: Additional parameters to pass to .part() method.

Returns:

  • ImageData

    rio_tiler.models.ImageData: ImageData instance with data, mask and input spatial info.

info async

info() -> Info

Return Dataset's info.

Returns:

  • Info

    rio_tiler.models.Info: Dataset info.

part async

part(bbox: BBox, dst_crs: CRS | None = None, bounds_crs: CRS = WGS84_CRS, indexes: Indexes | None = None, expression: str | None = None, max_size: int | None = None, height: int | None = None, width: int | None = None, unscale: bool = False, resampling_method: RIOResampling = 'nearest', reproject_method: WarpResampling = 'nearest', **kwargs: Any) -> ImageData

Read a Part of a Dataset.

Parameters:

  • bbox (tuple) –

    Output bounds (left, bottom, right, top) in target crs.

  • dst_crs (CRS, default: None ) –

    Overwrite target coordinate reference system. Defaults to bounds_crs.

  • bounds_crs (CRS, default: WGS84_CRS ) –

    Coordinate reference system of the input bounds. Defaults to WGS84.

  • indexes (sequence of int or int, default: None ) –

    Band indexes.

  • expression (str, default: None ) –

    rio-tiler expression (e.g. b1/b2+b3).

  • max_size (int, default: None ) –

    Limit the size of the longest dimension of the dataset read, respecting bounds X/Y aspect ratio. Defaults to 1024.

  • height (int, default: None ) –

    Output height of the array.

  • width (int, default: None ) –

    Output width of the array.

  • unscale (bool, default: False ) –

    Apply 'scales' and 'offsets' on output data value. Defaults to False.

  • resampling_method (str, default: 'nearest' ) –

    GDAL Resampling method to use when resizing. Defaults to "nearest".

  • reproject_method (str, default: 'nearest' ) –

    GDAL Resampling method to use when reprojecting. Defaults to "nearest".

Returns:

  • ImageData

    rio_tiler.models.ImageData: ImageData instance with data, mask and input spatial info.

point async

point(lon: float, lat: float, coord_crs: CRS = WGS84_CRS, indexes: Indexes | None = None, expression: str | None = None, unscale: bool = False, **kwargs: Any) -> PointData

Read a value from a Dataset.

Parameters:

  • lon (float) –

    Longitude.

  • lat (float) –

    Latitude.

  • coord_crs (CRS, default: WGS84_CRS ) –

    Coordinate Reference System of the input coords. Defaults to epsg:4326.

  • indexes (sequence of int or int, default: None ) –

    Band indexes.

  • expression (str | None, default: None ) –

    (str, optional): Expression to apply on the pixel values. Defaults to None.

  • unscale (bool, default: False ) –

    (bool, optional): Apply 'scales' and 'offsets' on output data value. Defaults to False.

Returns:

  • PointData ( PointData ) –

    Pixel value per bands/assets.

preview async

preview(indexes: Indexes | None = None, expression: str | None = None, dst_crs: CRS | None = None, max_size: int = 1024, height: int | None = None, width: int | None = None, unscale: bool = False, resampling_method: RIOResampling = 'nearest', reproject_method: WarpResampling = 'nearest', **kwargs: Any) -> ImageData

Read a preview of a Dataset.

Parameters:

  • indexes (sequence of int or int, default: None ) –

    Band indexes.

  • expression (str, default: None ) –

    rio-tiler expression (e.g. b1/b2+b3).

  • max_size (int, default: 1024 ) –

    Limit the size of the longest dimension of the dataset read, respecting bounds X/Y aspect ratio. Defaults to 1024.

  • height (int, default: None ) –

    Output height of the array.

  • width (int, default: None ) –

    Output width of the array.

  • unscale (bool, default: False ) –

    Apply 'scales' and 'offsets' on output data value. Defaults to False.

  • resampling_method (str, default: 'nearest' ) –

    GDAL Resampling method to use when resizing. Defaults to "nearest".

  • reproject_method (str, default: 'nearest' ) –

    GDAL Resampling method to use when reprojecting. Defaults to "nearest".

Returns:

  • ImageData

    rio_tiler.models.ImageData: ImageData instance with data, mask and input spatial info.

statistics async

statistics(categorical: bool = False, categories: list[float] | None = None, percentiles: list[int] | None = None, hist_options: dict | None = None, max_size: int = 1024, indexes: Indexes | None = None, expression: str | None = None, **kwargs: Any) -> dict[str, BandStatistics]

Return bands statistics from a dataset.

Parameters:

  • categorical (bool, default: False ) –

    treat input data as categorical data. Defaults to False.

  • categories (list of numbers, default: None ) –

    list of categories to return value for.

  • percentiles (list of numbers, default: None ) –

    list of percentile values to calculate. Defaults to [2, 98].

  • hist_options (dict, default: None ) –

    Options to forward to numpy.histogram function.

  • max_size (int, default: 1024 ) –

    Limit the size of the longest dimension of the dataset read, respecting bounds X/Y aspect ratio. Defaults to 1024.

  • indexes (int or sequence of int, default: None ) –

    Band indexes.

  • expression (str, default: None ) –

    rio-tiler expression (e.g. b1/b2+b3).

  • kwargs (optional, default: {} ) –

    Options to forward to self._read.

Returns:

  • dict[str, BandStatistics]

    dict[str, rio_tiler.models.BandStatistics]: bands statistics.

tile async

tile(tile_x: int, tile_y: int, tile_z: int, tilesize: int | None = None, indexes: Indexes | None = None, expression: str | None = None, **kwargs: Any) -> ImageData

Read a Map tile from the Dataset.

Parameters:

  • tile_x (int) –

    Tile's horizontal index.

  • tile_y (int) –

    Tile's vertical index.

  • tile_z (int) –

    Tile's zoom level index.

Returns:

  • ImageData

    rio_tiler.models.ImageData: ImageData instance with data, mask and tile spatial info.