mapshow - I can't seem to plot a geoTIFF
Show older comments
I'm trying to plot a geoTIFF image using mapshow. The file seems fine.
>> georasterinfo(filename)
ans =
RasterInfo with properties:
Filename: "/home/seisan/STUFF/data/geographic/SRC-GIS/Montserrat/dem/dem_2014_SHV_3m_hs.tif"
FileModifiedDate: 2023-03-23 10:35:44
FileSize: 10425084
FileFormat: "GeoTIFF"
RasterSize: [3495 3842]
NumBands: 1
NativeFormat: "int16"
MissingDataIndicator: 32767
Categories: []
ColorType: "grayscale"
Colormap: []
RasterReference: [1×1 map.rasterref.GeographicCellsReference]
CoordinateReferenceSystem: [1×1 geocrs]
Metadata: [1×1 struct]
And the file seems good.
>> [I, R] = readgeoraster(filename);
>> R
R =
GeographicCellsReference with properties:
LatitudeLimits: [16.6717577921979 16.7686941613068]
LongitudeLimits: [-62.2455721182769 -62.1390114515769]
RasterSize: [3495 3842]
RasterInterpretation: 'cells'
ColumnsStartFrom: 'north'
RowsStartFrom: 'west'
CellExtentInLatitude: 2.77357279281686e-05
CellExtentInLongitude: 2.77357279281675e-05
RasterExtentInLatitude: 0.0969363691089491
RasterExtentInLongitude: 0.10656066670002
XIntrinsicLimits: [0.5 3842.5]
YIntrinsicLimits: [0.5 3495.5]
CoordinateSystemType: 'geographic'
GeographicCRS: [1×1 geocrs]
AngleUnit: 'degree'
But mapshow gives the following error, after I convert the int16 values to uint16.
>> mapshow( uint16(I), R )
Error using checkRefObj
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 132)
validateMapRasterData('mapshow', dataArgs, displayType, HGpairs);
Error in mapshow (line 246)
h = showFcn(varargin{:});
What am i doing wrong?
Unfortunately, I can't share the geoTIFF file publicly.
Accepted Answer
More Answers (0)
Categories
Find more on Create Plots on Maps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!