MATLAB Answers

(mapping toolbox) Map axes xdata, ydata and zdata meaning?

10 ビュー (過去 30 日間)
abblah abblah
abblah abblah 2019 年 8 月 31 日
コメント済み: abblah abblah 2019 年 9 月 5 日
Hi,
I am using plot3m to plot the geographical location:
hplot = plot3m(lat,lon,h)
but to update the plot in the map it requires xdata, ydata, zdata
unfortunately there is not any documentation about the coordination of these fields in mapping toolbox?
how can I calculate xdata,ydata and zdata in the following code from lat,lon,h:
set(hplot,'xdata',xdata,'ydata',ydata,'zdata',zdata)
thanks in advance.
abblah

  0 件のコメント

Sign in to comment.

採用された回答

Kelly Kearney
Kelly Kearney 2019 年 9 月 5 日
編集済み: Kelly Kearney 2019 年 9 月 5 日
Map axes apply a geographic transform to convert the geographic coordinates to the projection used by the map axis. You can perform this transform manually using mfwdtran:
ax = worldmap('world');
lat = [0 45];
lon = [0 45];
hln = plotm(lat, lon, '-ro');
% Compare the line's X/YData to manually transformed data
hln.XData
hln.YData
[x,y] = mfwdtran(lat, lon)
% The results you should see...
ans =
0 3.8059e+06
ans =
0 4.7997e+06
x =
0 3.8059e+06
y =
0 4.7997e+06
To go the opposite direction (i.e. convert from projected x/y to lat/lon, use minvtran).

  1 件のコメント

abblah abblah
abblah abblah 2019 年 9 月 5 日
% Thanks for your exact and fast response.
% I recommend that the meaning of xdata,ydata,... in map axes
% be documented in mapping toolbox, in the next version.
% best regards.

Sign in to comment.

その他の回答 (1 件)

dpb
dpb 2019 年 8 月 31 日
The map is still an axes underneath the hood so the internal property names are the same. But, the property name is just a name, the data are what are associated with the particular axis direction...just use
set(hplot,'xdata',lat,'ydata',lon,'zdata',h)

  2 件のコメント

abblah abblah
abblah abblah 2019 年 9 月 4 日
Unfortunately you are wrong.
Matlab directly sets the xdata,ydata and zdata to lat,lon and h,
and does not consider any projection in setting these properties.
I tested it, the marker in the map after the first creation by plot3m,
disapeared when I used your proposed code!
Why matlab does not have any documention about in which cartesian coordinate 'xyz' in map axes are????
I am also waiting for the hero to answer my question.
dpb
dpb 2019 年 9 月 4 日
I don't have mapping TB so can't do more than read the doc...
Did you use hold on before trying to add more to the existing plot?
Submit support request to Support if joy doesn't ensue...

Sign in to comment.


Translated by