@turf/midpoint 6.4.0 → 7.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/es/index.js +0 -0
- package/dist/js/index.js +12 -7
- package/index.d.ts +2 -1
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
Takes two [points][1] and returns a point midway between them.
|
|
8
8
|
The midpoint is calculated geodesically, meaning the curvature of the earth is taken into account.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
### Parameters
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
* `point1` **[Coord][2]** first point
|
|
13
|
+
* `point2` **[Coord][2]** second point
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
### Examples
|
|
16
16
|
|
|
17
17
|
```javascript
|
|
18
18
|
var point1 = turf.point([144.834823, -37.771257]);
|
|
@@ -25,7 +25,7 @@ var addToMap = [point1, point2, midpoint];
|
|
|
25
25
|
midpoint.properties['marker-color'] = '#f00';
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
Returns **[Feature][3]
|
|
28
|
+
Returns **[Feature][3]<[Point][4]>** a point midway between `pt1` and `pt2`
|
|
29
29
|
|
|
30
30
|
[1]: https://tools.ietf.org/html/rfc7946#section-3.1.2
|
|
31
31
|
|
package/dist/es/index.js
CHANGED
|
File without changes
|
package/dist/js/index.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
var bearing = require('@turf/bearing');
|
|
4
|
+
var destination = require('@turf/destination');
|
|
5
|
+
var distance = require('@turf/distance');
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var bearing__default = /*#__PURE__*/_interopDefaultLegacy(bearing);
|
|
10
|
+
var destination__default = /*#__PURE__*/_interopDefaultLegacy(destination);
|
|
11
|
+
var distance__default = /*#__PURE__*/_interopDefaultLegacy(distance);
|
|
8
12
|
|
|
9
13
|
/**
|
|
10
14
|
* Takes two {@link Point|points} and returns a point midway between them.
|
|
@@ -25,11 +29,12 @@ var distance = _interopDefault(require('@turf/distance'));
|
|
|
25
29
|
* midpoint.properties['marker-color'] = '#f00';
|
|
26
30
|
*/
|
|
27
31
|
function midpoint(point1, point2) {
|
|
28
|
-
var dist =
|
|
29
|
-
var heading =
|
|
30
|
-
var midpoint =
|
|
32
|
+
var dist = distance__default['default'](point1, point2);
|
|
33
|
+
var heading = bearing__default['default'](point1, point2);
|
|
34
|
+
var midpoint = destination__default['default'](point1, dist / 2, heading);
|
|
31
35
|
|
|
32
36
|
return midpoint;
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
module.exports = midpoint;
|
|
40
|
+
module.exports.default = midpoint;
|
package/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/midpoint",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-alpha.0",
|
|
4
4
|
"description": "turf midpoint module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"type": "git",
|
|
13
13
|
"url": "git://github.com/Turfjs/turf.git"
|
|
14
14
|
},
|
|
15
|
+
"funding": "https://opencollective.com/turf",
|
|
15
16
|
"publishConfig": {
|
|
16
17
|
"access": "public"
|
|
17
18
|
},
|
|
@@ -51,10 +52,10 @@
|
|
|
51
52
|
"tape": "*"
|
|
52
53
|
},
|
|
53
54
|
"dependencies": {
|
|
54
|
-
"@turf/bearing": "^
|
|
55
|
-
"@turf/destination": "^
|
|
56
|
-
"@turf/distance": "^
|
|
57
|
-
"@turf/helpers": "^
|
|
55
|
+
"@turf/bearing": "^7.0.0-alpha.0",
|
|
56
|
+
"@turf/destination": "^7.0.0-alpha.0",
|
|
57
|
+
"@turf/distance": "^7.0.0-alpha.0",
|
|
58
|
+
"@turf/helpers": "^7.0.0-alpha.0"
|
|
58
59
|
},
|
|
59
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "0edc4c491b999e5ace770a61e1cf549f7c004189"
|
|
60
61
|
}
|