Attempting to read TIF file using the function 'readgeoraster' and get errors
24 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Scorp
el 12 de En. de 2023
Respondida: Amey Waghmare
el 16 de En. de 2023
- I downloaded from Natural Earth » 1:10m Ocean Bottom - Free vector and raster map data at 1:10m, 1:50m, and 1:110m scales (naturalearthdata.com)
- 1:10m Ocean Bottom
- unzipped it produced a OB_LR.tif and OB_LR.tfw
- When I tried to load the TIF using:
[A,R] = readgeoraster("OB_LR.tif");
figure
mapshow(A,R)
I got the following error:
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.GegraphicCellsReference.
What does this error mean and how do I read the OB_LR.tif file correctly?
0 comentarios
Respuesta aceptada
Amey Waghmare
el 16 de En. de 2023
Hi,
As per my understanding, you are unable to display the TIF file due to the error.
The TIF file ‘OB_LR.tif’ you are trying to plot is referenced using geographical coordinates, instead of projected map coordinates. Because of this, ‘mapshow’ function is causing error as it can display TIF file referenced using projected map coordinates.
In order to resolve the issue, you need to use ‘geoshow’ instead of ‘mapshow’, as geoshow can display TIF file referenced with geographial coordinates.
geoshow(A, R)
You can determine whether a file uses geographical coordinates or projected map coordinates from the readgeoraster command, which returns Spatial Reference ‘R’. If the data is referenced to a geographic coordinate system, then R is a GeographicCellsReference, else if the data is referenced to a projected coordinate system, then R is a MapCellsReference object.
For more information, please refer to the following documentation:
readgeoraster: https://in.mathworks.com/help/map/ref/readgeoraster.html
I hope this resolves the issue.
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!