Plotting Points on a Map

조회 수: 1 (최근 30일)
Thomas
Thomas 2014년 3월 4일
편집: dpb 2014년 3월 6일
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
dpb
dpb 2014년 3월 4일
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 2014년 3월 5일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

dpb
dpb 2014년 3월 5일
편집: dpb 2014년 3월 6일
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.

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by