Mapping Toolbox | ![]() ![]() |
Find equally spaced waypoints along a great circle
Syntax
[lat,lon] = gcwaypts(lat1,lon1,lat2,lon2) [lat,lon] = gcwaypts(lat1,lon1,lat2,lon2,nlegs) pts = gcwaypts(lat1,lon1,lat2,lon2...)
Background
This is a navigational function. As such, it assumes that all latitudes and longitudes are in degrees.
In navigational practice, great circle paths are often approximated by rhumb line segments. This is done to come reasonably close to the shortest distance between points without requiring course changes too frequently. The gcwaypts
command provides an easy means of finding waypoints along a great circle path that can serve as end points for rhumb line segments (track legs).
Description
[lat,lon] = gcwaypts(lat1,lon1,lat2,lon2) returns the coordinates of equally spaced points along a great circle path connecting two endpoints, (lat1,lon1
) and (lat2,lon2
).
[lat,lon] = gcwaypts(lat1,lon1,lat2,lon2,nlegs) specifies the number of equal-length track legs to calculate. nlegs+1
output points are returned, since a final endpoint is required. The default number of legs is 10.
pts = gcwaypts(lat1,lon1,lat2,lon2...) packs the outputs, which are otherwise two-column vectors, into a two-column matrix of the form [latitude longitude]
. This format for successive waypoints along a navigational track is called navigational track format in this guide. See the navigational track format
reference page in this section for more information.
Examples
Imagine you own a sailing yacht and are planning a voyage from North Point, Barbados (13.33° N,59.62°W), to Brest, France (48.33°N,4.83°W). To divide the track into three equal-length segments:
[l,g] = gcwaypts(13.33,-59.62,48.33,-4.83,3) l = 13.3300 27.3316 39.6250 48.3300 g = -59.6200 -45.8919 -28.4459 -4.8300
See Also
dreckon |
Dead reckon points for a track |
legs |
Courses and distances between waypoints |
navfix |
Mercator-based navigational fixing |
navigational track format |
Successive waypoints along a track |
track |
Connect waypoints |
![]() | gcpmap | gcxgc | ![]() |