Skip to content

GeoIO fails to load GeoTIFFs with internal overviews (GeoTIFFImageIterator) #192

@marcosdanieldasilva

Description

@marcosdanieldasilva

Description

GeoIO.load fails when loading GeoTIFF files that contain internal overviews (multiple IFDs), which are very common in drone orthomosaics and GDAL-generated rasters.

In these cases, GeoTIFF.read returns a GeoTIFFImageIterator instead of a single GeoTIFFImage, but GeoIO assumes a single image and calls image(::GeoTIFFImage), leading to a MethodError.

As a result, many valid GeoTIFFs that load correctly in GDAL-based tools (QGIS, Rasters.jl, rasterio) cannot be loaded with GeoIO.


Error message

ERROR: MethodError: no method matching image(::GeoTIFF.GeoTIFFImageIterator{...})

Steps to reproduce

using GeoIO
GeoIO.load("imgs.tif")

(imgs.tif is a GeoTIFF with internal overviews.)


Observed behavior

  • GeoIO.load throws a MethodError
  • GeoIO.read falls back to returning raw bytes (Vector{UInt8})
  • The file is a valid GeoTIFF

Expected behavior

GeoIO.load should load the base (full-resolution) image and ignore internal overviews, similarly to GDAL behavior.


Technical notes

Inspection with TiffImages.jl shows multiple IFDs (base image + overviews):

imgs = TiffImages.load("imgs.tif")
map(size, imgs)

Example result:

(16210, 16159)
(8105, 8080)
(4053, 4040)
(2027, 2020)
(1014, 1010)
(507, 505)
(254, 253)

Rasters.jl (via GDAL) loads the same file correctly and always exposes the base image.


Environment

  • OS: Windows
  • Julia Version 1.12.4
  • GeoIO Version: 1.21.5

Metadata

Metadata

Labels

bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions