How to plot a contour map in UTM projection?
이전 댓글 표시
I am trying to plot data over a regular grid(GRID_VEL50 corresponding to Northings and Eastings in meters-UTM map projection) in the form of filled contours. I want the corresponding map overlayed along with it. Following are the variables used in the code: GRID_VEL50 (dim:156X150),GRID_X (Eastings,dim:150) and GRID_Y (Northings,dim:156). Here is the script, I tried for plotting the same:
axesm('tranmerc','MapLatLimit',[7 37.5],'MapLonLimit',[66.667 98.6666717529297]);
framem; gridm; axis off; tightmap;
x11 =245895.96; %meter, the North-West corner(66.667 deg in long)
y11 =774370.68; %meter, the North-West corner(7 deg in lat)
dx1 = 25000; %in meter
dy1 =-25000; %in meter
R=makerefmat(x11, y11, dx1, dy1);
contourfm(GRID_VEL50,R,'r','LineWidth',0.0001)
coast = load('coast');
geoshow(coast.lat, coast.long, 'Color', 'black')
contourcbar
On running this script, it gives an error, stating :"Error using constructGeoRasterReference (line 45)." The referencing array comes out to be a 3X2 array as mentioned in help documentation.
R =
0 -25000
25000 0
220895.96 799370.68
I am unable to debug this. Is there any other method to plot contours in a specific map projection?
댓글 수: 4
Walter Roberson
2015년 9월 10일
Please show the complete error message. For example is it complaining about incompatible dimensions? Is it complaining about index out of range?
Tanvi Gupta
2015년 9월 10일
편집: Walter Roberson
2015년 9월 10일
Walter Roberson
2015년 9월 10일
You indicate lat 7 long 66.667 as your North-West corner, but your axesm latitudes are from 7 to 37.5 which implies that lat 7 is to be a South corner rather than a North corner. Please re-check which points are the North or South extremes and please check the sign of your dx1 and dy1 .
When I calculate with the dx1 and dy1 values you give, I do not as yet see any reason why the latitude would exceed +90 to -90, but I do see that it would be outside your map axes which suggests you have incorrect bounds or incorrect signs.
Tanvi Gupta
2015년 9월 11일
편집: Tanvi Gupta
2015년 9월 11일
답변 (1개)
Walter Roberson
2015년 9월 11일
In the documentation it is not clear to me how makerefmat distinguishes between the x/y case and the long/lat case. I speculate that if you pass integral numbers that it might interpret them as x/y, so try with
R=makerefmat(round(x11), round(y11), round(dx1), round(dy1));
댓글 수: 1
Tanvi Gupta
2015년 9월 11일
편집: Tanvi Gupta
2015년 9월 11일
카테고리
도움말 센터 및 File Exchange에서 Mapping Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!