Skip to content

weiji14/foss4g2025

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Accelerating GeoTIFF readers with Rust.

Presenter: Wei Ji Leong

When: Thursday, 20 November 2025, 16:30–16:55 (NZDT)

Where: WG308 TE IRINGA, Auckland University of Technology (AUT), Tāmaki Makaurau / Auckland, Aotearoa / New Zealand

Website: https://talks.osgeo.org/foss4g-2025/talk/MRPVGL

Abstract

Reading a Cloud-optimized GeoTIFF involves several steps, from fetching compressed bytes over a network/disk, decompressing those bytes, to finally parsing of TIFF tag metadata. Can we speed up the decoding using asynchronous methods, or even GPU-accelerated libraries? Let's see how we can program this in Rust!

Long description

How can we compose together a modern library to decode Cloud-optimized GeoTIFFs (COGs) efficiently? By using a programming language called Rust, with bindings to Python, WebAssembly and more, our goal is to enable applications that demand high-performance reads, such as web-based COG tilers or machine learning workflows leveraging Graphical Processing Units (GPUs). For CPU workflows, we delegate the network/disk transfer handling to the object_store crate, use various Rust-based algorithms for decompressing raw bytes, and let the async-tiff crate do the actual TIFF tag metadata and pixel data parsing. For GPU workflows, we swap the decompression library for nvCOMP, and do the TIFF parsing using nvTIFF, with the resulting pixel data decoded directly into CUDA device memory. Come and see how these asynchronous and GPU-accelerated GeoTIFF readers compare against GDAL's libertiff driver, and find out how we're making these performant low-level Rust-based readers more accessible by integrating with the xarray ecosystem and beyond!

Getting started

Pre-requisites

These are system-level dependencies you'll need to install:

The nvTIFF library's nvtiff.h file requires some patches before the Rust bindings can be generated, run the following commands with sudo:

sed --in-place "s/memLimit=0/memLimit/g" /usr/include/nvtiff.h
sed --in-place "s/stream=0/stream/g" /usr/include/nvtiff.h
sed --in-place "s/nvtiffTagDataType type/enum nvtiffTagDataType type/g" /usr/include/nvtiff.h

Running the benchmarks

To try out the code, start by cloning this repo-url

git clone <repo-url>
cd foss4g2025

Next, download a sample Sentinel-2 True Colour Image (TCI) GeoTIFF file (318.0MB), and convert it to a tiled GeoTIFF, changing from Deflate to LZW compression while setting Horizontal differencing predictor (272.2MB).

gdal raster convert --co COMPRESS=LZW --co TILED=YES --co PREDICTOR=2 https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/37/M/BV/2024/10/S2A_37MBV_20241029_0_L2A/TCI.tif benches/TCI_lzw.tif

Then, use cargo to install the dependencies, compile and run the benchmarks like so:

cargo bench  # Benchmarks on CPU-only
cargo bench --features cuda  # Benchmark reading to GPU (CUDA) memory

Output results will be printed to the terminal, and a HTML report can be viewed by opening the target/criterion/report/index.html file.

References

Links

License

All code in this repository is licensed under Mozilla Public License Version 2.0 (MPL-2.0). All other non-code content is licensed under Creative Commons Attribution-ShareAlike 4.0 International [(CC BY-SA 4.0)](https://creativecommons.org/licenses/by-sa/4.0

About

Accelerating GeoTIFF readers with Rust.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Languages