| Title: | TIFF Virtualization via Rust |
|---|---|
| Description: | Extract byte-range chunk references from cloud-hosted TIFF and COG files without reading pixel data. Uses the Rust 'async-tiff' and 'object_store' crates for async I/O across S3, GCS, Azure, HTTP, and local storage. Returns a data frame of tile offsets and metadata suitable for constructing Kerchunk or Zarr virtual stores. |
| Authors: | Michael Sumner [aut, cre] (ORCID: <https://orcid.org/0000-0002-2471-7511>) |
| Maintainer: | Michael Sumner <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0.9001 |
| Built: | 2026-03-07 08:30:02 UTC |
| Source: | https://github.com/hypertidy/rustycogs |
Takes the data frame from tiff_refs() and reshapes it into the Kerchunk
reference specification (version 1) as a list suitable for writing with
jsonlite::write_json().
refs_to_kerchunk(refs, var_name = "data")refs_to_kerchunk(refs, var_name = "data")
refs |
Data frame from |
var_name |
Name for the Zarr variable. Default |
A list in Kerchunk V1 format.
## Not run: refs <- tiff_refs("s3://bucket/file.tif", anon = TRUE) kc <- refs_to_kerchunk(refs) jsonlite::write_json(kc, "references.json", auto_unbox = TRUE) ## End(Not run)## Not run: refs <- tiff_refs("s3://bucket/file.tif", anon = TRUE) kc <- refs_to_kerchunk(refs) jsonlite::write_json(kc, "references.json", auto_unbox = TRUE) ## End(Not run)
Extract tile byte-range references from TIFF/COG files.
tiff_refs(paths, region, anon, concurrency)tiff_refs(paths, region, anon, concurrency)
paths |
Character vector of file paths or URLs (s3://, gs://, az://, http://, https://, or local paths). |
region |
Optional AWS region string (e.g. "us-west-2"). |
anon |
Logical, use anonymous/unsigned requests. Default FALSE. |
concurrency |
Integer, max concurrent file scans. Default 16. |
A data.frame with columns: path, ifd, tile_col, tile_row, offset, length, image_w, image_h, tile_w, tile_h, dtype, compression, bits_per_sample, samples_per_pixel, crs_epsg.
Fetch and decode a single tile from a TIFF/COG file.
tiff_tile(path, ifd_index, col, row, region, anon)tiff_tile(path, ifd_index, col, row, region, anon)
path |
File path or URL to the TIFF. |
ifd_index |
IFD index (0-based). Default 0 (full resolution). |
col |
Tile column (0-based). |
row |
Tile row (0-based). |
region |
Optional AWS region string. |
anon |
Logical, use anonymous requests. Default FALSE. |
A named list with components:
data: numeric vector of decoded pixel values
dim: integer vector c(height, width, bands)
dtype: character string (e.g. "<f4", "<u2")
Fetch and decode multiple tiles as a batch.
tiff_tiles(path, ifd_index, cols, rows, region, anon)tiff_tiles(path, ifd_index, cols, rows, region, anon)
path |
File path or URL to the TIFF. |
ifd_index |
IFD index (0-based). Default 0 (full resolution). |
cols |
Integer vector of tile columns (0-based). |
rows |
Integer vector of tile rows (0-based). |
region |
Optional AWS region string. |
anon |
Logical, use anonymous requests. Default FALSE. |
A list of tile results, each with data, dim, and dtype.
Convert tile data to a matrix or array
tile_to_array(tile)tile_to_array(tile)
tile |
A tile result from |
A matrix (single band) or 3D array (multi-band).