Hello
I have flight data from my drone: longitude, latitude, altitude.
I would like to put a flight profile on geoglobe.
I manage to get a result, nevertheless the flight tracing is of a single color.
I would like this line to correspond to the altitude or to altitude steps by using, for example, a colormap.
I couldn't figure out how to change the color on this chart and this is the first time I've used the uifigure.
Thank you :)
my code :
uif = uifigure("Name","Vol drone sur cartographie 3D");
uif.Position = [1320 100 1280 1080];
g = geoglobe(uif);
geoplot3(g,lat,lon,alt_abs,'LineWidth',4,'color','y')

 Réponse acceptée

Walter Roberson
Walter Roberson le 10 Déc 2024

1 vote

Any one geoplot3() call results in a single line of constant color. There is no way to have the single line be multiple colors or interpolated colors.
You will need to call geoplot3() several times, each time drawing a different (constant) color. For any one segment, it is not possible to do color interpolation.

4 commentaires

Marc Jakubowicz
Marc Jakubowicz le 11 Déc 2024
Modifié(e) : Marc Jakubowicz le 11 Déc 2024
This will probably really complicate things
uif = uifigure("Name","Vol drone sur cartographie 3D");
uif.Position = [1320 100 1280 1080];
g = geoglobe(uif);
hold(g,'on')
len=(size(alt_abs,1));
len2=len/2;
geoplot3(g,lat(1:len2),lon(1:len2),alt_abs(1:len2),'LineWidth',4,'color','y')
geoplot3(g,lat(len2:len),lon(len2:len),alt_abs(len2:len),'LineWidth',4,'color','g')
colormap jet %or as appropriate
cmap = colormap();
N = size(cmap,1);
Y = discretize(alt_abs, N);
uif = uifigure("Name","Vol drone sur cartographie 3D");
uif.Position = [1320 100 1280 1080];
g = geoglobe(uif);
hold(g, 'on')
for K = 1 : numel(alt_abs)-1
geoplot3(g, lat(K:K+1), lon(K:K+1), alt_abs(K:K+1), "LineWidth", 4, "Color", cmap(Y(K),:));
end
The color that will be used is the color associated with the start of each segment. Use cmap(Y(K+1),:) if you want the color to be associated with the end of each segment.
Marc Jakubowicz
Marc Jakubowicz le 11 Déc 2024
Modifié(e) : Marc Jakubowicz le 11 Déc 2024
It's not bad, it's beautiful, but it's a long time to trace
I put a geo.mat if you want to test
uif = uifigure("Name","Vol drone sur cartographie 3D");
uif.Position = [1320 100 1280 1080];
g = geoglobe(uif);
hold(g,'on')
cmap = colormap('jet');
len=numel(alt_abs);
alt_maxi=max(alt);
alt_min=min(alt);
alt_color=alt+abs(alt_min);
coef=257/max(alt_color);
alt_color=round(coef*alt_color);
step=10;
for i=1:step:(len-step)
color_idx=1+round((alt(i)+abs(alt_min))/(alt_maxi+abs(alt_min))*255);
geoplot3(g,lat(i:i+step),lon(i:i+step),alt_abs(i:i+step),'LineWidth',4,'color',cmap(color_idx,:))
end
Peter
Peter le 12 Déc 2024
Cool

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Geographic Plots dans Centre d'aide et File Exchange

Produits

Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by