How can I plot a cell referenced map?
8 views (last 30 days)
Show older comments
MathWorks Support Team
on 27 Jul 2017
Answered: MathWorks Support Team
on 27 Jul 2017
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
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.
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!