Function to calculate the great circle distance and azimuth between two geographic points on a spherical earth.
In surveying science, the azimuth is also known as 'bearing'. It is measured clockwise from the north.
There are the fore bearing and back bearing; the difference between them is 180 degrees. They are opposite to each other.
This function is useful when you do not have access to MATLAB's Mapping Toolbox.
Inputs:
Lon1 is the longitude of the first point; specified in decimal degrees.
Lon2 is the longitude of the second point; specified in decimal degrees.
Lat1 is the latitude of the first point; specified in decimal degrees.
Lat2 is the latitude of the second point; specified in decimal degrees.
DistanceUnit ::optional:: is the unit to express the computed distance in; specified as a string. Default is "km".
Outputs:
Distance is the great circle distance between the two geographic points. Unit is given by DistanceUnit; default is km.
ForeAzimuth is the direction (bearing) from the first point to the second point using the north as reference. Unit is degree or radian; default is degree.
BackAzimuth is the direction (bearing) from the second point to the first point using the north as reference. Unit is degree or radian; default is degree.
Usage example:
Lon1 = -10.167293 * ones(10,1);
Lon2 = -109.089123 * ones(10,1);
Lat1 = -59.810366 * ones(10,1);
Lat2 = 71.1873231 * ones(10,1);
[Distance, ForeAzimuth, BackAzimuth] = fArcDistance(Lon1, Lon2, Lat1, Lat2); % Distance in kilometres, Azimuth in degrees
[Distance, ForeAzimuth, BackAzimuth] = fArcDistance(Lon1, Lon2, Lat1, Lat2, "m"); % Distance in metres, Azimuth in degrees
[Distance, ForeAzimuth, BackAzimuth] = fArcDistance(Lon1, Lon2, Lat1, Lat2, "km"); % Distance in kilometres, Azimuth in degrees
[Distance, ForeAzimuth, BackAzimuth] = fArcDistance(Lon1, Lon2, Lat1, Lat2, "deg"); % Distance in degrees, Azimuth in degrees
[Distance, ForeAzimuth, BackAzimuth] = fArcDistance(Lon1, Lon2, Lat1, Lat2, "rad"); % Distance in radians, Azimuth in radians
[Distance, ForeAzimuth, BackAzimuth] = fArcDistance(Lon1, Lon2, Lat1, Lat2, "mile"); % Distance in statute miles, Azimuth in degrees
[Distance, ForeAzimuth, BackAzimuth] = fArcDistance(Lon1, Lon2, Lat1, Lat2, "nautical"); % Distance in nautical miles, Azimuth in degrees
인용 양식
Richard Fiifi Annan (2024). fArcDistance (https://www.mathworks.com/matlabcentral/fileexchange/173410-farcdistance), MATLAB Central File Exchange. 검색 날짜: .
MATLAB 릴리스 호환 정보
개발 환경:
R2020a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux태그
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!버전 | 게시됨 | 릴리스 정보 | |
---|---|---|---|
1.0.0 |