Display Navigational Tracks
Navigational tracks are most useful when graphically displayed. Traditionally, the navigator identifies and plots waypoints on a Mercator projection and then connects them with a straightedge, which on this projection results in rhumb line tracks. In the previous example, waypoints were chosen to approximate a great circle route, but they can be selected for a variety of other reasons.
Let's say that after arriving at Cape St. Vincent, your tanker must traverse the Straits of Gibraltar and then travel on to Port Said, the northern terminus of the Suez Canal. On the scale of the Mediterranean Sea, following great circle paths is of little concern compared to ensuring that the many straits and passages are safely transited. The navigator selects appropriate waypoints and plots them.
To accomplish this with Mapping Toolbox™ functions, you can display an axesm
-based map with a
Mercator projection, select appropriate map latitude and longitude limits to isolate the
area of interest, plot coastline data, and interactively mouse-select the waypoints with
the inputm
function. The track
function will
generate points to connect these waypoints, which can then be displayed with
plotm
.
For illustration, assume that the waypoints are known (or were gathered using
inputm
). To learn about using inputm
, see Pick Locations Interactively, or inputm
in the Mapping Toolbox reference pages.
waypoints = [36 -5; 36 -2; 38 5; 38 11; 35 13; 33 30; 31.5 32]
waypoints = 36.0000 -5.0000 36.0000 -2.0000 38.0000 5.0000 38.0000 11.0000 35.0000 13.0000 33.0000 30.0000 31.5000 32.0000
load coastlines axesm('MapProjection','mercator',... 'MapLatLimit',[30 47],'MapLonLimit',[-10 37]) framem plotm(coastlat,coastlon) [lttrk,lntrk] = track(waypoints); plotm(lttrk,lntrk,'r')
Although these track segments are straight lines on the Mercator projection, they are curves on others:
The segments of a track like this are called legs. Each of these
legs can be described in terms of course and distance. The function
legs
will take the waypoints in navigational track format and
return the course and distance required for each leg. Remember, the order of the points
in this format determines the direction of travel. Courses are therefore calculated from
each waypoint to its successor, not the reverse.
[courses,distances] = legs(waypoints)
courses = 90.0000 70.3132 90.0000 151.8186 98.0776 131.5684 distances = 145.6231 356.2117 283.6839 204.2073 854.0092 135.6415
Since this is a navigation function, the courses are all in degrees and the distances are in nautical miles. From these distances, speeds required to arrive at Port Said at a given time can be calculated. Southbound traffic is allowed to enter the canal only once per day, so this information might be economically significant, since unnecessarily high speeds can lead to high fuel costs.