Plotting Points on a Map

1 Ansicht (letzte 30 Tage)
Thomas
Thomas am 4 Mär. 2014
Bearbeitet: dpb am 6 Mär. 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 Kommentare
dpb
dpb am 4 Mär. 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 am 5 Mär. 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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

dpb
dpb am 5 Mär. 2014
Bearbeitet: dpb am 6 Mär. 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.

Kategorien

Mehr zu Mapping Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by