Geodesic path
Version 1.0 (12,5 KB) von
Peter Seibold
Return coordinates for the shortest path between two points on the earth (WGS84 ellipsoid)
Get coordinates for the geodesic path that starts at lat1, lon1 and ends at lat2, lon2.
INPUT:
- lat1: Start latitudes, double, column vector, -90 <= lat1 <= 90
- lon1: Start longitudes, double, column vector, same size n as lat1
- lat2: End latitudes, double, column vector, -90 <= lat2 <= 90, same size n as lat1
- lon2: Start longitudes, double, column vector, same size n as lat1
- points: optional, default 51 points including start and end point. They will have equal distances.
- a) one integer number k -> k equidistant points including start and end point
- b) a vector with k points in meter, points may be outside start and end points
OUTPUT:
- latPath: latitude of path points, n x k double array
- lonPath: longitude of path points, n x k double array
PRECISION:
The distance error of a path point is less than 100 nm
PROCESS TIME:
About 1 ms for 1000 geodesic path points on my PC.
Remark:
With latPath at pole, abs(latPath)>90-3*eps(90), lonPath is undefined, any lonPath is correct.
The code is based on two files in the geographiclib of Charles Karney
The original Matlab files 'geoddistance.m' and 'geodreckon.m' are at
https://de.mathworks.com/matlabcentral/fileexchange/50605-geographiclib
with copyright (c) Charles Karney (2012-2022) <charles@karney.com>.
The difference to the original files from C. Karney is:
Only calculation of a few parameters, all required subroutines included,
some unused parts removed, no Octave compatibility.
Zitieren als
Peter Seibold (2024). Geodesic path (https://www.mathworks.com/matlabcentral/fileexchange/171649-geodesic-path), MATLAB Central File Exchange. Abgerufen.
Kompatibilität der MATLAB-Version
Erstellt mit
R2020a
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS LinuxTags
Quellenangaben
Inspiriert von: geographiclib
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Live Editor erkunden
Erstellen Sie Skripte mit Code, Ausgabe und formatiertem Text in einem einzigen ausführbaren Dokument.
Version | Veröffentlicht | Versionshinweise | |
---|---|---|---|
1.0 |