turf.rhumbDistance
What is turf.rhumbDistance?
turf.rhumbDistance returns the distance along a rhumb line — a path of constant heading — between two Point features. Rhumb distance is always longer than the corresponding great-circle distance except along a meridian or the equator, so prefer turf.distance unless your problem is explicitly rhumb-based.
turf.rhumbDistance(from, to, options?) → numberOptions include:
units—'kilometers'(default),'meters','miles','nauticalmiles','radians','degrees'
When would you use turf.rhumbDistance?
Use turf.rhumbDistance in nautical and navigation contexts where the assumed path is constant-heading (the ship "holds a compass bearing"). It is the natural companion to turf.rhumbBearing and turf.rhumbDestination in a rhumb-line tooling set.
For aviation, routing, or generic "how far apart are these two points" questions, turf.distance is usually the correct choice.
undefinedFAQs
When does rhumb equal great-circle distance?
Along a meridian (same longitude) or along the equator, rhumb distance equals geodesic distance. Everywhere else rhumb distance is longer — sometimes substantially so at high latitudes.
How do I install just rhumbDistance?
npm install @turf/rhumb-distance. It depends only on @turf/helpers and @turf/invariant.
Does it handle the antimeridian?
The underlying math normalises longitude difference correctly, so crossing the antimeridian is handled. As with all coordinate math, validate inputs — a wildly out-of-range longitude produces nonsense.
What precision should I expect?
turf.rhumbDistance treats Earth as a sphere (radius 6371 km), giving sub-percent accuracy for typical use. For survey-grade geodesy consider an ellipsoidal implementation; for maps and UI, Turf is ample.