Effacer les filtres
Effacer les filtres

Display USGS DEM using geotiffread and mapshow

28 vues (au cours des 30 derniers jours)
Dominik
Dominik le 13 Mai 2012
Commenté : MaHa le 4 Mar 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 commentaire
Em
Em le 24 Mar 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

Connectez-vous pour commenter.

Réponse acceptée

Dominik
Dominik le 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 commentaire
Em
Em le 24 Mar 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.

Connectez-vous pour commenter.

Plus de réponses (1)

Wanda Crupa
Wanda Crupa le 13 Oct 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 commentaires
Eslam Wafdy
Eslam Wafdy le 12 Fév 2021
How to adjust the coordinates to be in WGS84?
MaHa
MaHa le 4 Mar 2021
Same question

Connectez-vous pour commenter.

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by