Does imread read subsets from cloud-optimized geotiffs

6 views (last 30 days)
cloud-optimized geotiff (COG) is a format to work with spatial raster data in the cloud ( I am currently working on a small coding project on extracting and downloading Landsat data from Microsoft's Planetary Computer. I managed to download individual images with some url based on a spatial bounding box using imread with the option 'PixelRegion' (imread(url,'PixelRegion',{ixr, ixc})). Yet, I am wondering whether imread internally downloads the entire image and then locally extracts the pixel region, or whether imread is able to do the extraction while reading the image. Latter would be great, because it would probably decrease download times by a lot.
I know, I could experiment and see how download times would scale with the size of the pixel region. However, perhaps someone from the image processing team could offer first-hand knowledge on this.
Moreover, I know this is not the place for enhancement requests. Yet, I think it would be great if geotiffread would have a pixel region or bounding box option. Alternatively, readgeoraster would be great to allow for urls as input.
Thanks and best regards, Wolfgang

Answers (1)

Vidip Jain
Vidip Jain on 24 Feb 2023
The behaviour of imread depends on the specific implementation, but in general, it is possible for the function to download and extract a specific region of interest without downloading the entire image.
In the case of Cloud Optimized GeoTIFFs (COGs), the file format is designed specifically to allow efficient access to specific regions of interest without requiring the entire image to be downloaded. COGs are organized into small, tiled files that can be accessed independently, allowing for selective download and processing.
When using imread with the 'PixelRegion' option, it should request only the necessary tiles to cover the specified region of interest, rather than downloading the entire image. This can significantly reduce download times, especially for large images.


Find more on Read, Write, and Modify Image in Help Center and File Exchange




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!