@turf/standard-deviational-ellipse 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 +15 -14
- package/dist/es/index.js +1 -1
- package/dist/js/index.js +13 -8
- package/index.d.ts +3 -3
- package/package.json +12 -11
package/README.md
CHANGED
|
@@ -16,22 +16,23 @@ in ArcGIS and the [QGIS Standard Deviational Ellipse Plugin][3]
|
|
|
16
16
|
**Bibliography**
|
|
17
17
|
|
|
18
18
|
• Robert S. Yuill, “The Standard Deviational Ellipse; An Updated Tool for
|
|
19
|
-
Spatial Description,”
|
|
20
|
-
doi:[10.2307/490885][4].
|
|
19
|
+
Spatial Description,” *Geografiska Annaler* 53, no. 1 (1971): 28–39,
|
|
20
|
+
doi:{@link [https://doi.org/10.2307/490885|10.2307/490885}][4].
|
|
21
21
|
|
|
22
22
|
• Paul Hanly Furfey, “A Note on Lefever’s “Standard Deviational Ellipse,”
|
|
23
|
-
|
|
24
|
-
doi:[10.1086/214336][5].
|
|
23
|
+
*American Journal of Sociology* 33, no. 1 (1927): 94—98,
|
|
24
|
+
doi:{@link [https://doi.org/10.1086/214336|10.1086/214336}][5].
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
### Parameters
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
- `options.weight` **[string][9]?** the property name used to weight the center
|
|
31
|
-
- `options.steps` **[number][10]** number of steps for the polygon (optional, default `64`)
|
|
32
|
-
- `options.properties` **[Object][8]** properties to pass to the resulting ellipse (optional, default `{}`)
|
|
28
|
+
* `points` **[FeatureCollection][6]<[Point][7]>** GeoJSON points
|
|
29
|
+
* `options` **[Object][8]** Optional parameters (optional, default `{}`)
|
|
33
30
|
|
|
34
|
-
**
|
|
31
|
+
* `options.weight` **[string][9]?** the property name used to weight the center
|
|
32
|
+
* `options.steps` **[number][10]** number of steps for the polygon (optional, default `64`)
|
|
33
|
+
* `options.properties` **[Object][8]** properties to pass to the resulting ellipse (optional, default `{}`)
|
|
34
|
+
|
|
35
|
+
### Examples
|
|
35
36
|
|
|
36
37
|
```javascript
|
|
37
38
|
var bbox = [-74, 40.72, -73.98, 40.74];
|
|
@@ -42,7 +43,7 @@ var sdEllipse = turf.standardDeviationalEllipse(points);
|
|
|
42
43
|
var addToMap = [points, sdEllipse];
|
|
43
44
|
```
|
|
44
45
|
|
|
45
|
-
Returns **[Feature][11]
|
|
46
|
+
Returns **[Feature][11]<[Polygon][12]>** an elliptical Polygon that includes approximately 1 SD of the dataset within it.
|
|
46
47
|
|
|
47
48
|
[1]: https://tools.ietf.org/html/rfc7946#section-3.3
|
|
48
49
|
|
|
@@ -50,9 +51,9 @@ Returns **[Feature][11]<[Polygon][12]>** an elliptical Polygon that includes
|
|
|
50
51
|
|
|
51
52
|
[3]: http://arken.nmbu.no/~havatv/gis/qgisplugins/SDEllipse/
|
|
52
53
|
|
|
53
|
-
[4]: https://doi.org/10.2307/490885
|
|
54
|
+
[4]: https://doi.org/10.2307/490885|10.2307/490885}
|
|
54
55
|
|
|
55
|
-
[5]: https://doi.org/10.1086/214336
|
|
56
|
+
[5]: https://doi.org/10.1086/214336|10.1086/214336}
|
|
56
57
|
|
|
57
58
|
[6]: https://tools.ietf.org/html/rfc7946#section-3.3
|
|
58
59
|
|
package/dist/es/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { coordAll, featureEach } from '@turf/meta';
|
|
2
2
|
import { getCoords } from '@turf/invariant';
|
|
3
|
-
import {
|
|
3
|
+
import { isObject, isNumber, featureCollection } from '@turf/helpers';
|
|
4
4
|
import centerMean from '@turf/center-mean';
|
|
5
5
|
import pointsWithinPolygon from '@turf/points-within-polygon';
|
|
6
6
|
import ellipse from '@turf/ellipse';
|
package/dist/js/index.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
4
|
-
|
|
5
3
|
var meta = require('@turf/meta');
|
|
6
4
|
var invariant = require('@turf/invariant');
|
|
7
5
|
var helpers = require('@turf/helpers');
|
|
8
|
-
var centerMean =
|
|
9
|
-
var pointsWithinPolygon =
|
|
10
|
-
var ellipse =
|
|
6
|
+
var centerMean = require('@turf/center-mean');
|
|
7
|
+
var pointsWithinPolygon = require('@turf/points-within-polygon');
|
|
8
|
+
var ellipse = require('@turf/ellipse');
|
|
9
|
+
|
|
10
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
|
+
|
|
12
|
+
var centerMean__default = /*#__PURE__*/_interopDefaultLegacy(centerMean);
|
|
13
|
+
var pointsWithinPolygon__default = /*#__PURE__*/_interopDefaultLegacy(pointsWithinPolygon);
|
|
14
|
+
var ellipse__default = /*#__PURE__*/_interopDefaultLegacy(ellipse);
|
|
11
15
|
|
|
12
16
|
/**
|
|
13
17
|
* Takes a {@link FeatureCollection} and returns a standard deviational ellipse,
|
|
@@ -61,7 +65,7 @@ function standardDeviationalEllipse(points, options) {
|
|
|
61
65
|
|
|
62
66
|
// Calculate mean center & number of features:
|
|
63
67
|
var numberOfFeatures = meta.coordAll(points).length;
|
|
64
|
-
var meanCenter =
|
|
68
|
+
var meanCenter = centerMean__default['default'](points, { weight: weightTerm });
|
|
65
69
|
|
|
66
70
|
// Calculate angle of rotation:
|
|
67
71
|
// [X, Y] = mean center of all [x, y].
|
|
@@ -113,13 +117,13 @@ function standardDeviationalEllipse(points, options) {
|
|
|
113
117
|
var sigmaX = Math.sqrt((2 * sigmaXsum) / weightsum);
|
|
114
118
|
var sigmaY = Math.sqrt((2 * sigmaYsum) / weightsum);
|
|
115
119
|
|
|
116
|
-
var theEllipse =
|
|
120
|
+
var theEllipse = ellipse__default['default'](meanCenter, sigmaX, sigmaY, {
|
|
117
121
|
units: "degrees",
|
|
118
122
|
angle: thetaDeg,
|
|
119
123
|
steps: steps,
|
|
120
124
|
properties: properties,
|
|
121
125
|
});
|
|
122
|
-
var pointsWithinEllipse =
|
|
126
|
+
var pointsWithinEllipse = pointsWithinPolygon__default['default'](
|
|
123
127
|
points,
|
|
124
128
|
helpers.featureCollection([theEllipse])
|
|
125
129
|
);
|
|
@@ -153,3 +157,4 @@ function getDeviations(coordinates, center) {
|
|
|
153
157
|
}
|
|
154
158
|
|
|
155
159
|
module.exports = standardDeviationalEllipse;
|
|
160
|
+
module.exports.default = standardDeviationalEllipse;
|
package/index.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
Feature,
|
|
4
4
|
Position,
|
|
5
5
|
Polygon,
|
|
6
|
-
|
|
6
|
+
GeoJsonProperties,
|
|
7
7
|
Point,
|
|
8
|
-
} from "
|
|
8
|
+
} from "geojson";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* http://turfjs.org/docs/#standarddeviational-ellipse
|
|
@@ -30,7 +30,7 @@ export interface StandardDeviationalEllipse extends Feature<Polygon> {
|
|
|
30
30
|
export default function (
|
|
31
31
|
points: FeatureCollection<Point>,
|
|
32
32
|
options?: {
|
|
33
|
-
properties?:
|
|
33
|
+
properties?: GeoJsonProperties;
|
|
34
34
|
weight?: string;
|
|
35
35
|
steps?: number;
|
|
36
36
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/standard-deviational-ellipse",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-alpha.0",
|
|
4
4
|
"description": "turf standard-deviational-ellipse module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"contributors": [
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"type": "git",
|
|
16
16
|
"url": "git://github.com/Turfjs/turf.git"
|
|
17
17
|
},
|
|
18
|
+
"funding": "https://opencollective.com/turf",
|
|
18
19
|
"publishConfig": {
|
|
19
20
|
"access": "public"
|
|
20
21
|
},
|
|
@@ -45,11 +46,11 @@
|
|
|
45
46
|
"docs": "node ../../scripts/generate-readmes",
|
|
46
47
|
"test": "npm-run-all test:*",
|
|
47
48
|
"test:tape": "node -r esm test.js",
|
|
48
|
-
"test:types": "tsc --esModuleInterop --noEmit types.ts"
|
|
49
|
+
"test:types": "tsc --esModuleInterop --noEmit --strict types.ts"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
|
-
"@turf/random": "^
|
|
52
|
-
"@turf/truncate": "^
|
|
52
|
+
"@turf/random": "^7.0.0-alpha.0",
|
|
53
|
+
"@turf/truncate": "^7.0.0-alpha.0",
|
|
53
54
|
"benchmark": "*",
|
|
54
55
|
"load-json-file": "*",
|
|
55
56
|
"npm-run-all": "*",
|
|
@@ -58,12 +59,12 @@
|
|
|
58
59
|
"write-json-file": "*"
|
|
59
60
|
},
|
|
60
61
|
"dependencies": {
|
|
61
|
-
"@turf/center-mean": "^
|
|
62
|
-
"@turf/ellipse": "^
|
|
63
|
-
"@turf/helpers": "^
|
|
64
|
-
"@turf/invariant": "^
|
|
65
|
-
"@turf/meta": "^
|
|
66
|
-
"@turf/points-within-polygon": "^
|
|
62
|
+
"@turf/center-mean": "^7.0.0-alpha.0",
|
|
63
|
+
"@turf/ellipse": "^7.0.0-alpha.0",
|
|
64
|
+
"@turf/helpers": "^7.0.0-alpha.0",
|
|
65
|
+
"@turf/invariant": "^7.0.0-alpha.0",
|
|
66
|
+
"@turf/meta": "^7.0.0-alpha.0",
|
|
67
|
+
"@turf/points-within-polygon": "^7.0.0-alpha.0"
|
|
67
68
|
},
|
|
68
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "0edc4c491b999e5ace770a61e1cf549f7c004189"
|
|
69
70
|
}
|