1
- import { Point } from "geojson" ;
2
1
import { getCoord } from "@turf/invariant" ;
3
2
import { radiansToLength , degreesToRadians , Coord , Units } from "@turf/helpers" ;
4
3
5
4
//http://en.wikipedia.org/wiki/Haversine_formula
6
5
//http://www.movable-type.co.uk/scripts/latlong.html
7
6
8
7
/**
9
- * Calculates the distance between two {@link Point|points } in degrees, radians, miles, or kilometers.
8
+ * Calculates the distance between two {@link Coord|coordinates } in degrees, radians, miles, or kilometers.
10
9
* This uses the [Haversine formula](http://en.wikipedia.org/wiki/Haversine_formula) to account for global curvature.
11
10
*
12
11
* @name distance
13
- * @param {Coord | Point } from origin point or coordinate
14
- * @param {Coord | Point } to destination point or coordinate
12
+ * @param {Coord } from origin coordinate
13
+ * @param {Coord } to destination coordinate
15
14
* @param {Object } [options={}] Optional parameters
16
15
* @param {string } [options.units='kilometers'] can be degrees, radians, miles, or kilometers
17
- * @returns {number } distance between the two points
16
+ * @returns {number } distance between the two coordinates
18
17
* @example
19
18
* var from = turf.point([-75.343, 39.984]);
20
19
* var to = turf.point([-75.534, 39.123]);
@@ -28,8 +27,8 @@ import { radiansToLength, degreesToRadians, Coord, Units } from "@turf/helpers";
28
27
* to.properties.distance = distance;
29
28
*/
30
29
function distance (
31
- from : Coord | Point ,
32
- to : Coord | Point ,
30
+ from : Coord ,
31
+ to : Coord ,
33
32
options : {
34
33
units ?: Units ;
35
34
} = { }
0 commit comments