Unable to plot raster using meshm
Afficher commentaires plus anciens
Hi,
I have the following demo code (using load topo) that works perfectly:
InitialAngle = -25;
Number_of_pannels = 3;
figure
for p = 1:Number_of_pannels
subplot(1,Number_of_pannels,p)
%-plot coastlines, and select vantage point-%
load coastlines
axesm('ortho','origin',[0 ((360/Number_of_pannels)*p)-InitialAngle]);
%-pot info-%
load topo
hs = meshm(topo,topolegend,size(topo));
%-make it pretty-%
axis off;
gridm on;
framem on;
plotm(coastlat,coastlon)
end
It produces the following figure:

I want to do the same, but instead of using the raster topo (which basically comes from matlab), I want to show my actual data (that comes from NASA in a tif file).
I read the data using the following:
projection_em = geotiffinfo('EM2001.tif');
[em_raster_tiff,em_reference_tiff] = geotiffread('EM2001.tif');
And then I try to plot it:
hs = meshm(em_raster_tiff,em_reference_tiff);
It gives the following error:
Error using internal.map.convertToGeoRasterRef (line 39)
Function MESHGRAT expected input argument 2, 'R', to be a 3-element
referencing vector, a 3-by-2 referencing matrix, or a (scalar)
geographic raster reference object.
Error in meshgrat (line 139)
R = internal.map.convertToGeoRasterRef( ...
Error in meshm (line 111)
[lat,lon] = meshgrat(Z, R, gratsize);
However,I'm using the "R" that I obtain from geotiffread... and it looks like this:
em_reference_tiff =
MapCellsReference with properties:
XWorldLimits: [-19640076.5206259 19730423.4793741]
YWorldLimits: [-9996423.89867413 9298576.10132587]
RasterSize: [38590 78741]
RasterInterpretation: 'cells'
ColumnsStartFrom: 'north'
RowsStartFrom: 'west'
CellExtentInWorldX: 500
CellExtentInWorldY: 500
RasterExtentInWorldX: 39370500
RasterExtentInWorldY: 19295000
XIntrinsicLimits: [0.5 78741.5]
YIntrinsicLimits: [0.5 38590.5]
TransformationType: 'rectilinear'
CoordinateSystemType: 'planar'
I'm clueless... I see that in the "topo" raster that Matlab uses as an example topolegend = [1 90 0], but I don't know what those numbers refer to.
I apreciate any help.
Cheers!
LG
PS: forgot to mention: mapshow(em_raster_tiff,jet,em_reference_tiff) works, but using mapshow I only get a square map with a stardard projection and no the 3D looking views of the Earth that I'm looking for.
Réponses (1)
Luis J Gilarranz
le 21 Jan 2020
Modifié(e) : Luis J Gilarranz
le 21 Jan 2020
1 commentaire
Luis J Gilarranz
le 21 Jan 2020
Catégories
En savoir plus sur Interact with Maps dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!