Hi,
I created a pcolor graph with the magnitude of the velocity of the wind in a specific location. I want to know how to add the topography of the place, I tried two options: with geobasemap('topographic') and with contour(z) where z= height (msl) matrix, but it didn't work.
If I use geobasemap separated from pcolor, I can see the specific area with the topography but without the magnitude of velocity. Should I switch to use geobasemap('topographic') and try to display the magnitude of the wind in that graphic? How is it possible?
The magnitude of the velocity and the coordinates (latitude and longitude) are 3 matrixes that have the same dimensions.
Thanks in advance.
Abby

 Accepted Answer

Adam Danz
Adam Danz on 28 Oct 2020
Edited: Adam Danz on 28 Oct 2020
The types of graphics objects that can be plotted to geographic axes are limited. For wind velocity, quiver arrows would be nice but neither quiver nor quiverm are accepted by geographic axes.
These options could visualize magnitudes at specific geo coordinates but they wouldn't specify the direction of a vector (ie, wind direction).
You're probably better off using map axes which allow for greater flexibility and support a wider range of graphics objects including quiver.
% Produce base map
load korea5c
worldmap(korea5c,korea5cR)
geoshow(korea5c,korea5cR,'DisplayType','texturemap')
demcmap(korea5c)
% Show the *real* axes
% axis on
% Get axis limits
lonLim = xlim();
latLim = ylim();
% Produce (fake) wind data
[lon,lat] = meshgrid(linspace(lonLim(1),lonLim(2),10), linspace(latLim(1),latLim(2),10));
U = sin(lat);
V = cos(lon);
% Plot wind velocity
hold on
quiver(lon,lat,U,V,'k','LineWidth',2)

8 Comments

Thank you, Adam, for your response. I have tried what you proposed, with topo60c instead of korea5c but it didn't work, because of this error:
Error using load
Unable to read file 'topo60c'. No such file or directory.
I think that korea5c will just work for that region and I didn't find the list of regions, I just found that topo60c should work for all the world.
I read the information about geoshow but I don't understand the meaning of the arguments korea5c and korea5cR. Is it about Raster Data? Should I create something like this for my data?
R = georefcells()
R =
GeographicCellsReference with properties:
LatitudeLimits: [0.5 2.5]
LongitudeLimits: [0.5 2.5]
RasterSize: [2 2]
RasterInterpretation: 'cells'
ColumnsStartFrom: 'south'
RowsStartFrom: 'west'
CellExtentInLatitude: 1
CellExtentInLongitude: 1
RasterExtentInLatitude: 2
RasterExtentInLongitude: 2
XIntrinsicLimits: [0.5 2.5]
YIntrinsicLimits: [0.5 2.5]
CoordinateSystemType: 'geographic'
AngleUnit: 'degree'
The first part of the code worked and displayed the region that I want with this lines:
latlim = [xxx xxx];
lonlim = [xxx xxx];
worldmap(latlim,lonlim);
But the graph is empty, so I think that I should write the following, as you mentioned, but I don't know what to write in the first two arguments:
geoshow(?,?,'DisplayType','texturemap');
I tried with the height matrix, it has a dimension of 149x150 but it didn't work
Thank you!!
I solved the problem using geoscatter as you said. I had to use reshape in order to transform the matrixes (149x150) to column vectors because it is necessary for geoscatter.
Thanks a lot!
Abby
" I have tried what you proposed, with topo60c instead of korea5c but it didn't work, because of this error:"
Did it work with the korea5c file? Those files are part of the Mapping Toolbox. Do you have that toolbox? If you do have it, it should be listed in the output to ver().
Also, what release of Matlab are you using?
"I read the information about geoshow but I don't understand the meaning of the arguments korea5c and korea5cR."
korea5c and korea5cR are variables in the korea5c file. They are used as the first two inputs to worldmap and geoshow under these syntaxes,
You can click those links to read about those inputs. The descriptions of each of those two variables may indicate different way to create/obtain those data. I'm not an expert on this topic.
"I solved the problem"
Nicely done! 🥳
Hello again Adam,
I'm using Matlab R2020a and I already have Mapping Toolbox 4.10 installed. I tried again what you replied days ago and I cannot use nither egm96geoid nor topo60c, the following error messages appear:
  • Error using load. Unable to read file 'egm96geoid'. No such file or directory.
  • Error using load. Unable to read file 'topo60c'. No such file or directory.
I found this on internet, I think that is for checking if the file is in the current folder and I realized that it is inside the folder:
dir your_file_name.mat
addpath(fullfile('your_path'));
Thanks in advance!
Abby
Indeed "topo60c" does not appear in the 2020a documentation. It must have been included from 20b, onward.
I don't know how you were using "egm96geoid" but it's been a function since r2006a.
@Shai Katz answer moved here
============================
@Adam Danz Thank you for your response.
Where can I see all the files that can be loaded? here is just an axample of korea5c file..
In addtion, What this line does:
[lon,lat] = meshgrid(linspace(lonLim(1),lonLim(2),10), linspace(latLim(1),latLim(2),10));
If I have my own lat and lon (and wind speed) so how should I adjust it to the script above?
I will add that all 3 are vectors.
Thanks again,
Shai
@Shai Katz, let's reserve the answers section for answers/solutions and use comment sections for discussion.
Those files come with MATALAB's Mapping Toolbox and appear in the documentation page below.
To see the location of those files,
which korea5c.mat
/MATLAB/examples/map/data/korea5c.mat

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!