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

Mapping Toolboxplot handle

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

Best Answer

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).