waypointsgc#
[latwaypoints, lonwaypoints, arclenwaypoints, azimuthwaypoints, arclen, azimuthdir, metedir] = waypointsgc(lat1, lon1, lat2, lon2, nmidwaypoints, CalcMethod, R, dispout)
Description#
Generate (Latitude,Longitude) points between two (Latitude,Longitude) points using Great Circle
Inputs#
- lat1
Latitude (y) of start point (first point) in (Degree)
- lon1
Longitude (x) of start point (first point) in (Degree)
- lat2
Latitude (y) of end point (last point) in (Degree)
- lon2
Longitude (x) of end point (last point) in (Degree)
- nmidwaypoints=1;
- Number of middle waypointsnmidwaypoints=1;: 1 point between first point and last point is generated
- CalcMethod=’haversine’;
- Distance calculation method‘cos’: Spherical law of cosines‘haversine’: Haversine formula‘vincenty’: Vincenty formula, Vincenty (1975)
- R=6371000;
Earth radius in (m), mean earth radius=6371000 m
- dispout=’no’;
Define to display outputs or not (‘yes’: display, ‘no’: not display)
Outputs#
- latwaypoints
- Latitude of waypoints along a line from start point to end point in (Degree)lat1 and lat2 are included, total number of points are nmidwaypoints+2
- lonwaypoints
- Longitude of waypoints along a line from start point to end point in (Degree)lon1 and lon2 are included, total number of points are nmidwaypoints+2
- arclenwaypoints
Distance of waypoints from start point in (m)
- azimuthwaypoints
Azimuth (bearing) of waypoints from start point in (Degree)
- arclen
Total distance from start point to end point in (m)
- azimuthdir
- Azimuth (bearing or compass direction) from start point to end point in (Degree)0 (degree): toward North, 90 (degree): toward East, 180 (degree): toward South, 270 (degree): toward West
- metedir
- Meteorological direction from start point to end point in (Degree)0 (degree): from North, 90 (degree): from East, 180 (degree): from South, 270 (degree): from West
Examples#
lat1=29.5; %First point
lon1=-89.4; %First point
lat2=29.7; %last point
lon2=-89.4; %last point
[latwaypoints,lonwaypoints,arclenwaypoints,azimuthwaypoints,arclen,azimuthdir,metedir]=waypointsgc(lat1,lon1,lat2,lon2);
lat1=29; %First point
lon1=-89; %First point
lat2=30; %Last point
lon2=-90; %Last point
[latwaypoints,lonwaypoints,arclenwaypoints,azimuthwaypoints,arclen,azimuthdir,metedir]=waypointsgc(lat1,lon1,lat2,lon2,3,'haversine',6371000,'yes');
References#
Vincenty, T. (1975). Direct and inverse solutions of geodesics on the ellipsoid with application of nested equations. Survey review, 23(176), 88-93.