Problem While reading geotiff.

29 visualizaciones (últimos 30 días)
Danraj
Danraj el 2 de Abr. de 2024
Comentada: DGM el 16 de Abr. de 2024
[maskImg, R_mask] = readgeoraster(maskTiffPath);
Error using readgeoraster
Unable to read data. File might use an encoding or specialized format features that are not supported.
  1 comentario
DGM
DGM el 2 de Abr. de 2024
Editada: DGM el 2 de Abr. de 2024
So now that you know there's a problem reading a particular file, are you going to let us know anything about the file? Regular TIFF files can be attached if they're zipped, but since it's a geotiff, there's a possibility that it might be large enough attaching it is problematic. We'd have to see.
FWIW, I'm not exactly familiar with geotiffs specifically, the format variations, or the inner workings or limitations of readgeoraster(). I'm just trying to get the question into an answerable form.

Iniciar sesión para comentar.

Respuestas (1)

Rupesh
Rupesh el 16 de Abr. de 2024
Hi Danraj,
I understand that you are encountering an error with the “readgeoraster” function in MATLAB. You can expect this error either due to the file's encoding or specialized format features. Below are some possible root causes for the error along with some debugging methods you can use to resolve this issue.
Unsupported File Encoding or Compression: “GeoTIFF” and other geospatial raster formats can use various compression schemes (e.g., “LZW”,” JPEG”, “Deflate”), If MATLAB's “readgeoraster” does not support the specific scheme used by your file, it will fail to read it. You can use some tools (e.g., GDAL) to check the file's compression scheme and encoding. If they're not supported by MATLAB, you can consider converting the files into desired formats.
Specialized Format Features: “GeoTIFF” files can contain complex metadata, including custom tags or non-standard color spaces, which might not be fully supported by “readgeoraster”. If the file uses unsupported features, converting it to a more commonly supported format or compression scheme can help. Tools like GDAL can be used for conversion.
% example for Specialized Format Features
gdal_translate -of GTiff -co "COMPRESS=NONE" input_file.tif output_file.tif
Use geotiffread for GeoTIFF Files: If “readgeoraster” fails, try using “geotiffread” (for GeoTIFF files), which might handle certain files differently.
% example for geotiffread
try
[A, R] = geotiffread('your_file.tif');
catch ME
disp('Error with geotiffread:');
disp(ME.message);
end
All of the above methods might help you to resolve the issues, also while debugging make sure that you are using the latest version of MATLAB and the Mapping Toolbox, as updates might include support for more formats or compression schemes.You can also refer to the below documents regarding operations of the “readgeoraster” function and supported file and data formats.
Hope this helps!
  1 comentario
DGM
DGM el 16 de Abr. de 2024
It would make more sense for the try/catch example to demonstrate the fallback behavior that the text suggests that it does.

Iniciar sesión para comentar.

Categorías

Más información sobre Data Import and Analysis en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by