Display USGS DTM using mapshow

34 ビュー (過去 30 日間)
SUSHMA MB
SUSHMA MB 2016 年 9 月 14 日
コメント済み: OJ27 2020 年 7 月 2 日
[germany, R] = geotiffread('srtm_germany_dtm.tif');
germany = double(germany);
figure
mapshow(germany, R);
I have also converted the matrix germany of type single into doulble. but still im getting the following error:
Error using checkRefObj (line 25)
Function mapshow expected input number 2, R, to be either a 3-by-2 referencing matrix or a scalar map raster reference object. Instead its
type was: map.rasterref.GeographicCellsReference.
Error in validateMapRasterData>parseImageInputs (line 112)
refmat = checkRefObj(mapfcnname, R, size(A), R_position);
Error in validateMapRasterData>validateImageComponent (line 92)
[A, R] = parseImageInputs(mapfcnname, dataArgs{:}, cmap, rules );
Error in validateMapRasterData (line 26)
[Z, SpatialRef] = validateImageComponent(mapfcnname, ...
Error in maprastershow (line 126)
[Z, SpatialRef, displayType, HGpairs] = ...
Error in mapshow (line 228)
h = showFcn(varargin{:});
Can anyone please help me to display the geotiff file.

回答 (2 件)

Kojiro Saito
Kojiro Saito 2016 年 9 月 17 日
If you also have a tfw file, the following code should work.
[X cmap] = imread('srtm_germany_dtm.tif');
R = worldfileread('srtm_germany_dtm.tfw');
figure
X = double(X);
mapshow(X, cmap, R);
Or, do you have only a geotiff file?
  3 件のコメント
Kojiro Saito
Kojiro Saito 2016 年 9 月 21 日
How about using geoshow?
[X, R] = geotiffread('srtm_germany_dtm.tif');
X = double(X);
geoshow(X, R);
Let me know whether this will view your geotiff file on MATLAB.
OJ27
OJ27 2020 年 7 月 2 日
I tried this code and this is the error
Error using checkImage>checkRGBImage (line 60)
RGB images must be size M-by-N-by-3.
Error in checkImage (line 45)
RGB = checkRGBImage(A);
Error in validateTextureComponent (line 25)
dataArgs{imageIndex} = checkImage( ...
Error in validateGeoRasterData (line 23)
[dataArgs, R, imageIndex, rules] = validateTextureComponent( ...
Error in georastershow (line 144)
validateGeoRasterData('geoshow', dataArgs, displayType);
Error in geoshow (line 242)
h = showFcn(varargin{:});

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


Brian
Brian 2017 年 1 月 26 日
I'm having this same problem. Using geoshow results in the same problem.
  5 件のコメント
Stephen Blackstock
Stephen Blackstock 2020 年 4 月 15 日
I also have this problem. Why doesn't this work?
BN
BN 2020 年 4 月 16 日

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

Community Treasure Hunt

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

Start Hunting!

Translated by