버전 1.4 (31.6 KB) 작성자: Chad Greene
Simply calculate distance traveled along a lat/lon path
다운로드 수: 1.8K
업데이트 날짜: 2015/1/13

라이선스 보기

pathdist returns an array of the cumulative distance traveled along a path.
pathDistance = pathdist(lat,lon)
pathDistance = pathdist(...,LengthUnit)
pathDistance = pathdist(...,track)
pathDistance = pathdist(...,'refpoint',[reflat reflon])

pathDistance = pathdist(lat,lon) returns the cumulative distance traveled along the path given by (lat,|lon|). Distance is in meters by default, referenced to the WGS84 ellipsoid. The pathDistance array will be the same size as lat and lon.

pathDistance = pathdist(...,LengthUnit) specifies any valid length unit. The following are a few LengthUnit options. See documentation for validateLengthUnit for a complete list of options.

meter 'm', 'meter(s)', 'metre(s)' (default)
kilometer 'km', 'kilometer(s)', 'kilometre(s)'
nautical mile 'nm', 'naut mi', 'nautical mile(s)'
foot 'ft', 'international ft','foot', 'international foot', 'feet', 'international feet'
inch 'in', 'inch', 'inches'
yard 'yd', 'yds', 'yard(s)'
mile 'mi', 'mile(s)','international mile(s)'

pathDistance = pathdist(...,track) uses the input string track to specify either a great circle/geodesic or a rhumb line arc. If track equals 'gc' (the default value), then great circle distances are computed on a sphere and geodesic distances are computed on the WGS84 ellipsoid. If track equals 'rh', then rhumb line distances are computed on the WGS84 ellipsoid.

pathDistance = pathdist(...,'refpoint',[reflat reflon]) references the path distance to the point along the path nearest to [reflat reflon]. For this calculation, pathdist finds the point in lat and lon which is nearest to [reflat reflon] and assumes this point along lat,|lon| is the zero point. This is only an approximation, and may give erroneous results in cases of very sharply-curving, crossing, or otherwise spaghetti-like paths; where [reflat reflon] lies far from any point along the path, or where points along the path are spaced far apart.

인용 양식

Chad Greene (2024). pathdist (, MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2012b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
Help CenterMATLAB Answers에서 Simulation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!


버전 게시됨 릴리스 정보

In this morning's release I accidentally set default units to kilometers. Default units are now meters.

Now includes support for miles, feet, nautical miles, and many more length units.

bug fix.

Now accepts NaN inputs.