geotiffread and MultiLayer images

43 次查看(过去 30 天)
Mohammad Abouali
Mohammad Abouali2014-8-14
评论: Alex ,2020-11-3
When I try to read multi layer geotiff images using geotiffread, I receive an error that the multiple image in that geotiff are not of the same size.
This is how I tried to read the image
[I,R]=geotiffread('filename.tif',1) % to force read only the first layer.
I can read them just fine with the imread and using the imfinfo I manually create R myself. But I think this is a bug that needs to be addressed in geotiffread.
MATLAB is correct about the multiple images not having the same size. The fact is that those other images/layers are the pyramid or overview layers. However, that does not make any sense that geotiff read not be able to read the specified layer from the file and complaining about it.
Here is the error:
Error using geotiffinfo>readinfo (line 261)
Multiple images exist in the file and their sizes are different.
Error in geotiffinfo (line 241)
info = readinfo(filename);
Error in geotiffread (line 78)
info = geotiffinfo(filename);
  8 个评论
davide verdicchio
davide verdicchio 2019-12-20
I tried also with the following link, but when I try to modify the "Geotiffinfo" function it still gives me an error.
How can I solve it?


回答(3 个)

Matthew Cooper
Matthew Cooper 2016-11-22
I had the same problem with a DEM I generated using Agisoft Photoscan software. To solve the problem, I loaded the DEM into ArcMap and then I exported the DEM. This is an annoying work around but it solved the problem for me - I was able to read the exported DEM into Matlab. I have actually used this workaround to solve a few other incompatibility issues between various geospatial analysis software and Matlab, namely issues involving "no data" values. Arc does something when it exports the DEM that makes the exported DEM compatible with geotiffread.
  1 个评论
jian liu
jian liu 2017-3-24
Ihe another band in the tif file is mask_file or external rectangle consist of 0 or 255.


Daan Poppema
Daan Poppema 2019-9-4
I had the same problem with DEM's from Agisoft Photoscan/Metashape. Unfortunately the solutions above did not work for me. In the end, my workaround is changing the settings in Agisoft during DEM export. If you deselect 'write tiled TIFF' (for the pyramid scheme) and deselect 'Generate TIFF overviews' in Agisoft, the resulting tiff only contains 1 image and you don't get an error in Matlab.

Andrew Sole
Andrew Sole 2020-10-22
It seems that readgeoraster gets around the same error which I encountered when attempting to load a geotiff from the ITS_LIVE ice velocity dataset:
  1 个评论
Alex 2020-11-3
This is because the ITS_LIVE .tif files are cloud optimized geotiffs that have multiple resolutions embeded into a single file


Community Treasure Hunt

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

Start Hunting!

Translated by