MATLAB: I want to read and view geotiff in matlab but I could not open the file ‘AddisAbaba.tif’ file. Any help please

Mapping Toolboxmapshow error

Here is the command I have used
[AddisAbaba,R] = geotiffread('AddisAbaba.tif');
figure
mapshow(AddisAbaba,R);
axis image off
but i have got error of the following error
Error using checkRefObj (line 25)
Function mapshow expected input number 2, R, to be either a 3-by-2 referencing matrix or a
scalar map raster reference object. Instead its type was:
map.rasterref.GeographicCellsReference.
Error in validateMapRasterData>parseImageInputs (line 112) refmat = checkRefObj(mapfcnname, R, size(A), R_position);
Error in validateMapRasterData>validateImageComponent (line 92) [A, R] = parseImageInputs(mapfcnname, dataArgs{:}, cmap, rules );
Error in validateMapRasterData (line 26) [Z, SpatialRef] = validateImageComponent(mapfcnname, …
Error in maprastershow (line 126) [Z, SpatialRef, displayType, HGpairs] = …
Error in mapshow (line 228) h = showFcn(varargin{:});
Error in DEM (line 5) mapshow(AddisAbaba,R);

Best Answer

Your GeoTIFF seems to be geographic reference data, so how about trying geoshow instead of mapshow?
The following codes would work.
[AddisAbaba,R] = geotiffread('AddisAbaba.tif');
figure
geoshow(AddisAbaba,R);
axis image off
Related Question