making map in matlab

6 views (last 30 days)
Tanmoyee Bhattacharya
Tanmoyee Bhattacharya on 27 Apr 2016
Commented: Chad Greene on 28 Apr 2016
if true
% code
end
I have longitude,latitude and rainfall like that
77.245 31.465 427.94
77.195 31.465 427.92
77.145 31.465 427.79
77.095 31.465 428.06
77.045 31.465 428.23
76.995 31.465 267.87
76.945 31.465 268.11
76.895 31.465 268.18
77.445 31.515 311.14
77.395 31.515 314.24
77.345 31.515 312.6
77.295 31.515 312.42
77.245 31.515 326.54
77.195 31.515 325.4
77.145 31.515 312.24
77.095 31.515 320.51
77.045 31.515 339.76
76.995 31.515 408.82
76.945 31.515 409.66
76.895 31.515 578.72
76.845 31.515 578.37
76.795 31.515 578.15
76.495 31.515 100.37
76.445 31.515 383.13
77.545 31.565 1035.7
77.495 31.565 93.819
77.445 31.565 305.56
77.395 31.565 308.28
77.345 31.565 312.08
77.295 31.565 312.76
77.245 31.565 311.08
77.195 31.565 310.44
77.145 31.565 312.58
77.095 31.565 322.01
77.045 31.565 343.49
76.995 31.565 409.37
76.945 31.565 410.05
76.895 31.565 579.17
76.845 31.565 578.51
76.795 31.565 578.49
76.595 31.565 579.08
76.545 31.565 148.36
76.495 31.565 100.34
76.445 31.565 100.36
76.395 31.565 383.23
There are 555 values.According to one latitude longitude are changing.The third column is rainfall.I have to create a map of rainfall from this in matlab. How it is possible.
  2 Comments
KSSV
KSSV on 27 Apr 2016
You said 555 values, is the data given above complete? If not attach it as a text file.
Tanmoyee Bhattacharya
Tanmoyee Bhattacharya on 28 Apr 2016
Sir I attach a full length file of 555 values.

Sign in to comment.

Accepted Answer

Chad Greene
Chad Greene on 27 Apr 2016
Edited: Chad Greene on 27 Apr 2016
It looks like your data already conform to an evenly-spaced grid, even though they're columnated. That's good, because it means using scatteredInterpolant is overkill. I'd use xyz2grid, which is easier to code, computationally more efficient, and does not make up any data. Let's call the matrix you posted A:
A = [77.245 31.465 427.94
77.195 31.465 427.92
77.145 31.465 427.79
. . .
. . .
. . .
76.395 31.565 383.23];
[lon,lat,rainfall] = xyz2grid(A(:,1),A(:,2),A(:,3));
pcolor(lon,lat,rainfall)
shading flat
borders('countries')
That last line is optional, it's just a way to plot national borders with a function found on File Exchange.
  3 Comments
Tanmoyee Bhattacharya
Tanmoyee Bhattacharya on 28 Apr 2016
Sir It's so helpful.Image is coming perfectly.
Chad Greene
Chad Greene on 28 Apr 2016
Great, I'm glad it's working.

Sign in to comment.

More Answers (1)

Andrei Bobrov
Andrei Bobrov on 27 Apr 2016
Let X - your data - array [555 x 3]
F = scatteredInterpolant(X(:,1),X(:,2),X(:,3));
a = min(X(:,1:2));
b = max(X(:,1:2));
[ii,jj] = ndgrid(linspace(a(1),b(1),1000), linspace(a(2),b(2),1000));
out = F(ii,jj);

Categories

Find more on Geographic Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!