How can I plot a cell referenced map?

8 views (last 30 days)
I am trying to create a "cell referenced" map with data from an M by N matrix "topo". Can this be done using the "geoshow" function?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jul 2017
You can create a "cell referenced" plot by first creating a "GeographicCellsReference" object using the function "georefcells". The code below illustrates this workflow using a built-in MATLAB example:
>>load topo
>>R = georefcells(topolatlim, topolonlim, size(topo));
>>worldmap world
>>setm(gca,'mapprojection','pcarree');
>>S = geoshow(topo, R, 'DisplayType','texturemap');
Note that here, "topolatlim" and "topolonlim" specify the limits of the latitude and the longitude in increasing order (i.e. from South to North and West to East, respectively).
For releases R2015a and earlier, the function "georefcells" is not available. In earlier releases, replace the line of code that calls "georefcells" with
>>R = georasterref('LatLim',topolatlim,'LonLim',topolonlim,'RasterSize',size(topo));
Also note that the built-in example is slightly different in earlier releases, so it is necessary to construct "topolatlim" and "topolonlim" from the data in the MAT file.

More Answers (0)

Products


Release

R2017a

Community Treasure Hunt

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

Start Hunting!