Filter löschen
Filter löschen

Display USGS DEM using geotiffread and mapshow

28 Ansichten (letzte 30 Tage)
Dominik
Dominik am 13 Mai 2012
Kommentiert: MaHa am 4 Mär. 2021
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 Kommentar
Em
Em am 24 Mär. 2014
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

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Dominik
Dominik am 19 Mai 2012
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 Kommentar
Em
Em am 24 Mär. 2014
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Wanda Crupa
Wanda Crupa am 13 Okt. 2019
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 Kommentare
Eslam Wafdy
Eslam Wafdy am 12 Feb. 2021
How to adjust the coordinates to be in WGS84?
MaHa
MaHa am 4 Mär. 2021
Same question

Melden Sie sich an, um zu kommentieren.

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by