Problem While reading geotiff.

32 次查看(过去 30 天)
Danraj
Danraj 2024-4-2
评论: DGM 2024-4-16
[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 个评论
DGM
DGM 2024-4-2
编辑:DGM 2024-4-2
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.

请先登录,再进行评论。

回答(1 个)

Rupesh
Rupesh 2024-4-16
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 个评论
DGM
DGM 2024-4-16
It would make more sense for the try/catch example to demonstrate the fallback behavior that the text suggests that it does.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Data Import and Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by