フィルターのクリア

Display USGS DEM using geotiffread and mapshow

28 ビュー (過去 30 日間)
Dominik
Dominik 2012 年 5 月 13 日
コメント済み: MaHa 2021 年 3 月 4 日
Hi, 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? Thanks
  1 件のコメント
Em
Em 2014 年 3 月 24 日
I encounter this same issue using 2013b. My file is from the Global Land Survey DEM (<http://glcf.umd.edu/data/glsdem/)>. I read the file using:
[B, R] = geotiffread('/home/mrd20/matlab/geo/data/GLSDEM_n040e060');
After applying the fix above to B (convert to double), I then find mapshow objecting to 'R' which has the type:
map.rasterref.GeographicCellsReference
where as mapshow expects either a 3-by-2 referencing matrix or a scalar map raster reference object.
I find that geoshow does not list an error condition, but creates a 'blank' plot having the correct lat/lon info on the axes.
I've been working through geospatial webinars, but working with non-WMD resources is not given attention there.
Cheers, ~ Em

サインインしてコメントする。

採用された回答

Dominik
Dominik 2012 年 5 月 19 日
geotiffread results in a type 'single' but mapshow defaults to a 'image' that can only accept 'double' (and some other formations not including 'single'). Either A=double(A) or mapshow(A,R,'DisplayType','surface')
  1 件のコメント
Em
Em 2014 年 3 月 24 日
I encounter this same issue using 2013b. My file is from the Global Land Survey DEM (<http://glcf.umd.edu/data/glsdem/)>. I read the file using:
[B, R] = geotiffread('/home/mrd20/matlab/geo/data/GLSDEM_n040e060');
After applying the fix above to B (convert to double), I then find mapshow objecting to 'R' which has the type:
map.rasterref.GeographicCellsReference
where as mapshow expects either a 3-by-2 referencing matrix or a scalar map raster reference object.
I find that geoshow does not list an error condition, but creates a 'blank' plot having the correct lat/lon info on the axes.
I've been working through geospatial webinars, but working with non-WMD resources is not given attention there.

サインインしてコメントする。

その他の回答 (1 件)

Wanda Crupa
Wanda Crupa 2019 年 10 月 13 日
You can also show geotiff images using the imagesc(geotiff) command.However, this does not display them using geographic coordinates as needed for a map, but is great for cheking any image processing of raster data.
Example:
[geotiff1, R] = geotiffread('my_geotiff.tiff');
imagesc(geotiff1);
raster.png
  2 件のコメント
Eslam Wafdy
Eslam Wafdy 2021 年 2 月 12 日
How to adjust the coordinates to be in WGS84?
MaHa
MaHa 2021 年 3 月 4 日
Same question

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by