Skip to content

distance

geometry · scripts/geometry/distance.m

DISTANCE  Geodesic or rhumb-line distance and azimuth between points.
  GitLab %2100 (optim-map Vincenty path); #2095 golden-map-geodesy;
  %2099 vectorized sphere haversine; #2365 rhumb ('rh'); #245 sphere baseline.

  [ARCLEN,AZ] = DISTANCE(LAT1,LON1,LAT2,LON2) is the great-circle arc
  in degrees and the forward azimuth in degrees clockwise from north.
  [ARCLEN,AZ] = DISTANCE(LAT1,LON1,LAT2,LON2,ELLIPSOID) uses Vincenty's
  formula. ARCLEN is then in the same length unit as the semimajor axis.
  ELLIPSOID is a reference-ellipsoid struct or [semimajor eccentricity].
  [ARCLEN,AZ] = DISTANCE(PT1,PT2) accepts N-by-2 [lat lon] matrices.
  TRAILING 'degrees' or 'radians' sets the angle unit. Leading 'gc' selects
  the geodesic; leading 'rh' selects the sphere rhumb line (loxodrome).

  MATLAB R2026a Mapping Toolbox signatures and defaults.