Skip to main content

Async GeoTIFF reader for Python

Project description

async-geotiff

Fast, async GeoTIFF and Cloud-Optimized GeoTIFF (COG) reader for Python, wrapping the Rust-based Async-TIFF library.

Documentation website.
Release post for v0.1

Features

  • Asynchronous, read-only support for GeoTIFF and COG formats.
  • High-level, familiar, easy to use API.
    • Load from full-resolution or reduced-resolution overviews as 3D NumPy arrays.
    • Simplify handling of nodata values and nodata masks with NumPy masked arrays.
    • Interpret Coordinate Reference Systems as PyProj CRS objects.
    • Find pixels with geotransforms exposed as Affine matrices.
    • Represent internal COG tile grids as TileMatrixSets via Morecantile integration.
  • Performance-focused:
    • Rust core ensures compiled performance.
    • CPU-bound image decoding happens in a thread pool, without blocking the async executor.
    • Buffer protocol integration for zero-copy data sharing between Rust and Python.
    • Request coalescing for adjacent tiles.
  • Lightweight with no GDAL dependency.
  • Access data from AWS S3, Google Cloud Storage, and Azure Storage via integration with obstore.
  • Full type hinting for all operations.
  • Broad decompression support: Deflate, JPEG, JPEG2000, LERC, LERC_DEFLATE, LERC_ZSTD, LZMA, LZW, WebP, ZSTD.
  • Support for any arbitrary backend via obspec protocols.

Anti-Features

Features explicitly not in scope:

  • No pixel resampling.
  • No warping/reprojection.
  • Automatic resolution/overview selection

Resampling and warping bring significant additional complexity and are out of scope for this library. Consider using Async-GeoTIFF to load data, then Rasterio's In-Memory Files to resample or reproject data, if needed.

Example

First create a "store", such as an S3Store, GCSStore, AzureStore, or LocalStore for reading data from AWS S3, Google Cloud, Azure Storage, or local files. Refer to obstore documentation for more information.

from obstore.store import S3Store

store = S3Store("sentinel-cogs", region="us-west-2", skip_signature=True)
path = "sentinel-s2-l2a-cogs/12/S/UF/2022/6/S2B_12SUF_20220609_0_L2A/TCI.tif"

Then open a GeoTIFF:

from async_geotiff import GeoTIFF

geotiff = await GeoTIFF.open(path, store=store)

On the GeoTIFF instance you have metadata about the image, such as its affine transform and Coordinate Reference System:

geotiff.transform
# Affine(10.0, 0.0, 300000.0,
#        0.0, -10.0, 4100040.0)

geotiff.crs
# <Projected CRS: EPSG:32612>
# Name: WGS 84 / UTM zone 12N

For a COG, you can access the overviews, or reduced resolution versions, of the image:

# Overviews are ordered from finest to coarsest resolution
# In this case, access the second-coarsest resolution version of the image
overview = geotiff.overviews[-2]

Then we can read data from the image. This loads a 512-pixel square from the upper-left corner of the selected overview.

from async_geotiff import Window

window = Window(col_off=0, row_off=0, width=512, height=512)
array = await overview.read(window=window)

This RasterArray instance has data, mask, and some other metadata about the fetched array data.

Plot, using rasterio.plot.show (requires matplotlib):

import rasterio.plot

rasterio.plot.show(array.data)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

async_geotiff-0.4.0.tar.gz (26.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

async_geotiff-0.4.0-py3-none-any.whl (33.3 kB view details)

Uploaded Python 3

File details

Details for the file async_geotiff-0.4.0.tar.gz.

File metadata

  • Download URL: async_geotiff-0.4.0.tar.gz
  • Upload date:
  • Size: 26.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for async_geotiff-0.4.0.tar.gz
Algorithm Hash digest
SHA256 2386cc72e1e66cb36fdb296c6ef3100ba4c5e086950f0ce691f1a86d164fda7b
MD5 8aa11fe0b9e8f17a953b4dfaf468dadc
BLAKE2b-256 120368a66597ef21b4e59ee284fbe75393fb84df5f11343d63ef6c0248f4db36

See more details on using hashes here.

Provenance

The following attestation bundles were made for async_geotiff-0.4.0.tar.gz:

Publisher: release.yml on developmentseed/async-geotiff

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file async_geotiff-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: async_geotiff-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 33.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for async_geotiff-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0cf262441775e48f6acabe45706dcf2a0268edcd7f52108c88dc2efb1eb76b2a
MD5 b322dfa49d56ecd57224063ad1fd157b
BLAKE2b-256 f3649b88762c3103d2749689ccd013715f03e7a578426973eb4ec24776c05018

See more details on using hashes here.

Provenance

The following attestation bundles were made for async_geotiff-0.4.0-py3-none-any.whl:

Publisher: release.yml on developmentseed/async-geotiff

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page