Borrar filtros
Borrar filtros

Display USGS DEM using geotiffread and mapshow

28 visualizaciones (últimos 30 días)
Dominik
Dominik el 13 de Mayo de 2012
Comentada: MaHa el 4 de Mzo. de 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 comentario
Em
Em el 24 de Mzo. de 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

Iniciar sesión para comentar.

Respuesta aceptada

Dominik
Dominik el 19 de Mayo de 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 comentario
Em
Em el 24 de Mzo. de 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.

Iniciar sesión para comentar.

Más respuestas (1)

Wanda Crupa
Wanda Crupa el 13 de Oct. de 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 comentarios
Eslam Wafdy
Eslam Wafdy el 12 de Feb. de 2021
How to adjust the coordinates to be in WGS84?
MaHa
MaHa el 4 de Mzo. de 2021
Same question

Iniciar sesión para comentar.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by