# How can I plot trajectories on top of a map?

15 vues (au cours des 30 derniers jours)
Michael le 13 Août 2014
I wish to plot different series of lat/lon values onto a map and connect together with a line (i.e. hurricane tracking).
How can I do this on Matlab?
##### 1 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
Salaheddin Hosseinzadeh le 13 Août 2014
please see matlab documentation or simply type these on matlab command line
doc plot
doc line
doc hold
Hope this helps.

Connectez-vous pour commenter.

### Réponse acceptée

Christopher Berry le 13 Août 2014
Modifié(e) : Christopher Berry le 13 Août 2014
The Mapping toolbox has a number of great functions to help out with exactly this type of thing.
If you just want the specific points you currently have as lat,lon to be translated into the map coordinates x,y,z use the function mfwdtran, like this:
[x,y,z] = mfwdtran(lat,lon,0)
Then you can use whatever method of displaying and connecting your points that you like.
Alternately, you can also use mapping specific functions, such as linem or plotm. Take a look at this example from the doc for linem:
axesm sinusoid; framem
linem([15; 0; -45; 15],[-100; 0; 100; 170],'r-')
Either way, if you also want to draw either rumb line tracks or great circle tracks connecting the locations, you can take advantage of the function track2 to generate additional lat,lon points to connect any two points. Here is the example from the doc that shows this pretty well:
% Set up the axes.
axesm('mercator','MapLatLimit',[30 50],'MapLonLimit',[-40 40])
% Calculate the great circle track.
[lattrkgc,lontrkgc] = track2(40,-35,40,35);
% Calculate the rhumb line track.
[lattrkrh,lontrkrh] = track2('rh',40,-35,40,35);
% Plot both tracks.
plotm(lattrkgc,lontrkgc,'g')
plotm(lattrkrh,lontrkrh,'r')
Basically, any plotting function in base MATLAB, just add m to the end of it and if it exists in the Mapping Toolbox, then it does basically the same thing except with lat,lon coordinates, instead of x,y,z coordinates.
Hope that helps.
##### 1 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
Michael le 14 Août 2014
thanks Chris!

Connectez-vous pour commenter.

### Plus de réponses (1)

Polina Vasilyeva le 12 Fév 2018
Excuse me, may be you know is it possible to plot this trajectories on the colour dependsing on the speed wind in every coordinate?
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Vector Fields dans Help Center et File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by