MATLAB Answers

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

16 views (last 30 days)
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:
thanks in advance.

Accepted Answer

Kelly Kearney
Kelly Kearney on 5 Sep 2019
Edited: Kelly Kearney on 5 Sep 2019
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
[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 Comment
abblah abblah
abblah abblah on 5 Sep 2019
% 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.

More Answers (1)

dpb on 31 Aug 2019
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
dpb on 4 Sep 2019
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.

Community Treasure Hunt

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

Start Hunting!