# Why is the length of one degree in Turf 0.9988?

Calculating the (spherical) distance along one degree of longitude at the equator in Turf returns a number less than 1 (Try it):

``````require('@turf/turf').distance([0,0], [1, 0], { units: 'degrees' })
0.9988329686371696
``````

Why is this? Is the WGS84 ellipsoid not exactly 360 degrees?

• Could it be that your line goes towards north? Just guessing. – user30184 Jun 7 '18 at 21:26
• The distance from [0,0] to [0,10] is the same as from [0,0] to [10,0], so turf is using a spherical model rather than an ellipsoid. Not sure that explains why the distance is less than the coordinate difference in degrees – Spacedman Jun 7 '18 at 21:48

This seems to be the end result of an interesting conversion from radians to degrees.

``````t.convertLength(Math.PI,"radians","degrees")
179.78993435469053
``````

PI radians should be 180 degrees. Looking at the turf source, conversion is done by multiplying by a factor defined in the turf-helpers module:

https://github.com/Turfjs/turf/blob/4ffa95cd8acc74ef1cdff79cdd85802651ef5965/packages/turf-helpers/index.ts#L50

The relevant bits are:

``````export let earthRadius = 6371008.8;

/**
* Unit of measurement factors using a spherical (non-ellipsoid) earth radius.
*
* @memberof helpers
* @type {Object}
*/
export let factors: {[key: string]: number} = {
...
``````

That gives a degree to radian conversion factor of (using R here):

``````> earthRadius = 6371008.8
> degrees
 57.22891
``````

whereas the number of degrees in a radian is:

``````> 180/pi
 57.29578
``````

Given that everything else is spherical, and I can't see any reason for making the definition of the length of a degree any different from the mathematical one, I suspect the earth radius has been changed at some point (there are commits to the source for this) but the scale factor hasn't been recomputed (because the denominator of 111325 doesn't convert degrees to radians correctly).

I'll raise an issue and see what they say...

https://github.com/Turfjs/turf/issues/1406

• Thanks! I had thought the difference was too much for a rounding/approximation error. – Steve Bennett Jun 8 '18 at 1:42