mapshow - I can't seem to plot a geoTIFF

30 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Cris LaPierre
Cris LaPierre il 23 Mar 2023
Modificato: Cris LaPierre il 23 Mar 2023
Your variable R is a GeographicCellsReference object. However, mapshow specifies that R must be either a MapCellsReference or MapPostingsReference or GeographicPostingsReference map raster reference object, or a 3x2 matrix.
I do not believe a utility exists yet to convert between these grids (see here).
Try using geoshow instead.
  1 Commento
dormant
dormant il 23 Mar 2023
Modificato: dormant il 23 Mar 2023
Many thanks. I managed to plot it using imshow, but it required a lot of fiddling to get it georeferenced and (especially) to plot data on top of it.

Accedi per commentare.

Più risposte (0)

Prodotti


Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by