To achieve this, you need to use interpolation to determine the altitude values to place the graphics objects created from VMAP0 data to sit on a topographic surface. More specifically, you need to use the latitude, longitude, and altitude data from the topographic grid as the basis to calculate the altitude values for the given latitude and longitude values from the VMAP0 data.
[latsize,lonsize] = size(Z);
latlocs = linspace(latlim(1),latlim(2),latsize);
lonlocs = linspace(lonlim(1),lonlim(2),lonsize);
for i=1:length(VMAPlines)
str = VMAPlines(i).tag;
if ~isempty(strmatch('Accurate;',str))
NaNLocs = find(isnan(VMAPlines(i).long));
for n = 1:length(NaNLocs)-1
tmplat = VMAPlines(i).lat(NaNLocs(n)+1:NaNLocs(n+1)-1);
tmplon = VMAPlines(i).long(NaNLocs(n)+1:NaNLocs(n+1)-1);
tmpalt = interp2(lonlocs,latlocs,Z,tmplon,tmplat);
VMAPlines(i).alt = [VMAPlines(i).alt; NaN; tmpalt(:)];
end
hTRline(i) = displaym(VMAPlines(i));
end
end
You can use this approach to "drape" vector data other than VMAP0 over terrain by substituting the appropriate data structures for VMAPlines. Note that there may be locations where the vectors become hidden for short distances.
Best Answer