fArcDistance

Function to calculate the great circle distance, forward and backward azimuths between two geographic points on a spherical earth.
0.0 次下载
更新时间 2024/10/3

查看许可证

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