I'm trying to use USGS DEMs in MATLAB but after reading it in with geotiffread, mapshow produces an error. Based on the documentation, I tried
[A, R] = geotiffread('NED_10340081')
figure
mapshow(A, R);
but I get
Error using mapshow
Expected input number 1, I or X or RGB, to be one of these types:
uint8, uint16, double, logical
Instead its type was single.
Error in validateMapRasterData>parseImageInputs (line 109)
validateattributes(A, {'uint8', 'uint16', 'double', 'logical'}, ...
Error in validateMapRasterData>validateImageComponent (line 93)
[A, R] = parseImageInputs(mapfcnname, dataArgs{:}, cmap, rules );
Error in validateMapRasterData (line 27)
[Z, SpatialRef] = validateImageComponent(mapfcnname, ...
Error in maprastershow (line 127)
[Z, SpatialRef, displayType, HGpairs] = ...
Error in mapshow (line 231)
h = showFcn(varargin{:});
My matrix A is of type single...is that the problem? and how do I fix this? Here is a download link for the DEM http://snowserver.colorado.edu/pub/fromDominik/NED_10340081.zip Thanks PS I crossposted this at http://www.mathworks.com/matlabcentral/answers/38255-display-usgs-dem-using-geotiffread-and-mapshow
I finally figured it out.
geotiffread
gives a matrix type 'single' but mapshow defaults to show an image
which only accepts type 'double' (and some others). So the solution here is to either:
A=double(A);
or
mapshow(A,R,'DisplayType','surface');