Plotting Points on a Map

1 view (last 30 days)
Thomas
Thomas on 4 Mar 2014
Edited: dpb on 6 Mar 2014
I am doing a study, which requires to create a plot showing rainfall totals on a map. How do I do this? I figured that if I was able to set the axis to latlon, then I could manually put on these points on to a plot and put the map as a background. My question though,is how do you do this? I don't even know where to start!
  2 Comments
dpb
dpb on 4 Mar 2014
Firstly, do you have the Mapping Toolbox or have to do this from base Matlab? What form do you have data in for
a) drawing the map, and
b) the rainfall data?
Thomas
Thomas on 5 Mar 2014
Just base Matlab
I have a base OS map saved as a jpeg and then rainfall data has been calculated in totals by Matlab already.

Sign in to comment.

Answers (1)

dpb
dpb on 5 Mar 2014
Edited: dpb on 6 Mar 2014
Well, I'm no image guru w/ Matlab, but the basic is simply to load the figure and then add on to it. You don't say exactly how you intend/want to display the rainfall data--
m=imread('usmap-physical.jpeg'); % use your file, obviously
image(m) % and display it
[nr,nc]=size(m); % the size of the image
Now the hard part will be to determine the locations of some points on the map that you can use as reference coordinates and then scale the locations of your data to that. It's just solving for the slope and intercept for the x- and y- axis lengths of the image but you do have to have some way of locating a known position.
Then, once that's done, compute the x,y coordinates in the scale image coordinates and convert the rainfall data to string...
rfstr=num2str(rf,'%.1f'); % NB: rf _MUST_ be column vector
hold on % don't wipe out the image, plot on top of it htxt=text(x,y,rfstr,'color','r','backgroundcolor',0.7*ones(1,3),'fontsize',8);
Then, you modify the axis labels or hide them or whatever to finish cleaning up the appearance as desired.

Categories

Find more on Geographic Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!