@turf/nearest-neighbor-analysis
Advanced tools
Comparing version 7.1.0 to 7.2.0
import { Feature, Polygon, FeatureCollection, GeoJsonProperties } from 'geojson'; | ||
import { Units, AreaUnits } from '@turf/helpers'; | ||
/** | ||
* Nearest neighbour statistics. | ||
* | ||
* @typedef {object} NearestNeighborStatistics | ||
* @property {(Units & AreaUnits)} units | ||
* @property {string} arealUnits | ||
* @property {number} observedMeanDistance | ||
* @property {number} expectedMeanDistance | ||
* @property {number} numberOfPoints | ||
* @property {number} zScore | ||
*/ | ||
interface NearestNeighborStatistics { | ||
@@ -12,2 +23,10 @@ units: Units & AreaUnits; | ||
} | ||
/** | ||
* Nearest neighbour study area polygon feature. | ||
* | ||
* @typedef {object} NearestNeighborStudyArea | ||
* @extends Feature<Polygon> | ||
* @property {GeoJsonProperties} properties | ||
* @property {NearestNeighborStatistics} properties.nearestNeighborAnalysis | ||
*/ | ||
interface NearestNeighborStudyArea extends Feature<Polygon> { | ||
@@ -24,3 +43,3 @@ properties: { | ||
* | ||
* It returns a {@link Feature<Polygon>} of the study area, with the results of | ||
* It returns a {@link Feature}<{@link Polygon}> of the study area, with the results of | ||
* the analysis attached as part of of the `nearestNeighborAnalysis` property | ||
@@ -42,3 +61,3 @@ * of the study area's `properties`. The attached | ||
* - This analysis is _very_ sensitive to the study area provided. | ||
* If no {@link Feature<Polygon>} is passed as the study area, the function draws a box | ||
* If no {@link Feature}<{@link Polygon}> is passed as the study area, the function draws a box | ||
* around the data, which may distort the findings. This analysis works best | ||
@@ -57,9 +76,9 @@ * with a bounded area of interest within with the data is either clustered, | ||
* | ||
* @name nearestNeighborAnalysis | ||
* @function | ||
* @param {FeatureCollection<any>} dataset FeatureCollection (pref. of points) to study | ||
* @param {Object} [options={}] Optional parameters | ||
* @param {Feature<Polygon>} [options.studyArea] polygon representing the study area | ||
* @param {string} [options.units='kilometers'] unit of measurement for distances and, squared, area. | ||
* @param {Object} [options.properties={}] properties | ||
* @returns {Feature<Polygon>} A polygon of the study area or an approximation of one. | ||
* @param {Units & AreaUnits} [options.units='kilometers'] unit of measurement for distances and, squared, area. | ||
* @param {GeoJsonProperties} [options.properties={}] properties | ||
* @returns {NearestNeighborStudyArea} A polygon of the study area or an approximation of one. | ||
* @example | ||
@@ -66,0 +85,0 @@ * var bbox = [-65, 40, -63, 42]; |
{ | ||
"name": "@turf/nearest-neighbor-analysis", | ||
"version": "7.1.0", | ||
"version": "7.2.0", | ||
"description": "turf nearest-neighbor-analysis module", | ||
@@ -55,27 +55,27 @@ "author": "Turf Authors", | ||
"devDependencies": { | ||
"@turf/truncate": "^7.1.0", | ||
"@turf/truncate": "^7.2.0", | ||
"@types/benchmark": "^2.1.5", | ||
"@types/tape": "^4.2.32", | ||
"@types/tape": "^4.13.4", | ||
"benchmark": "^2.1.4", | ||
"load-json-file": "^7.0.1", | ||
"npm-run-all": "^4.1.5", | ||
"tape": "^5.7.2", | ||
"tsup": "^8.0.1", | ||
"tsx": "^4.6.2", | ||
"typescript": "^5.2.2", | ||
"tape": "^5.9.0", | ||
"tsup": "^8.3.5", | ||
"tsx": "^4.19.2", | ||
"typescript": "^5.5.4", | ||
"write-json-file": "^5.0.0" | ||
}, | ||
"dependencies": { | ||
"@turf/area": "^7.1.0", | ||
"@turf/bbox": "^7.1.0", | ||
"@turf/bbox-polygon": "^7.1.0", | ||
"@turf/centroid": "^7.1.0", | ||
"@turf/distance": "^7.1.0", | ||
"@turf/helpers": "^7.1.0", | ||
"@turf/meta": "^7.1.0", | ||
"@turf/nearest-point": "^7.1.0", | ||
"@turf/area": "^7.2.0", | ||
"@turf/bbox": "^7.2.0", | ||
"@turf/bbox-polygon": "^7.2.0", | ||
"@turf/centroid": "^7.2.0", | ||
"@turf/distance": "^7.2.0", | ||
"@turf/helpers": "^7.2.0", | ||
"@turf/meta": "^7.2.0", | ||
"@turf/nearest-point": "^7.2.0", | ||
"@types/geojson": "^7946.0.10", | ||
"tslib": "^2.6.2" | ||
"tslib": "^2.8.1" | ||
}, | ||
"gitHead": "68915eeebc9278bb40dec3f1034499698a0561ef" | ||
"gitHead": "7b0f0374c4668cd569f8904c71e2ae7d941be867" | ||
} |
@@ -5,2 +5,28 @@ # @turf/nearest-neighbor-analysis | ||
## NearestNeighborStatistics | ||
Nearest neighbour statistics. | ||
Type: [object][1] | ||
### Properties | ||
* `arealUnits` **[string][2]**  | ||
* `observedMeanDistance` **[number][3]**  | ||
* `expectedMeanDistance` **[number][3]**  | ||
* `numberOfPoints` **[number][3]**  | ||
* `zScore` **[number][3]**  | ||
## NearestNeighborStudyArea | ||
Nearest neighbour study area polygon feature. | ||
Type: [object][1] | ||
### Properties | ||
* `properties` **[GeoJsonProperties][4]**  | ||
* `properties.nearestNeighborAnalysis` **[NearestNeighborStatistics][5]**  | ||
## nearestNeighborAnalysis | ||
@@ -12,6 +38,6 @@ | ||
It returns a [Feature\<Polygon>][1] of the study area, with the results of | ||
It returns a [Feature][4]<[Polygon][6]> of the study area, with the results of | ||
the analysis attached as part of of the `nearestNeighborAnalysis` property | ||
of the study area's `properties`. The attached | ||
[*z*-score][2] indicates how many | ||
[*z*-score][7] indicates how many | ||
standard deviations above or below the expected mean distance the data's | ||
@@ -26,7 +52,7 @@ observed mean distance is. The more negative, the more clustered. The more | ||
* Though the analysis will work on any [FeatureCollection][3] type, it | ||
works best with [Point][4] collections. | ||
* Though the analysis will work on any [FeatureCollection][8] type, it | ||
works best with [Point][9] collections. | ||
* This analysis is *very* sensitive to the study area provided. | ||
If no [Feature\<Polygon>][1] is passed as the study area, the function draws a box | ||
If no [Feature][4]<[Polygon][6]> is passed as the study area, the function draws a box | ||
around the data, which may distort the findings. This analysis works best | ||
@@ -43,12 +69,11 @@ with a bounded area of interest within with the data is either clustered, | ||
Measure of Spatial Relationships in Populations,” *Ecology* 35, no. 4 | ||
(1954): 445–453, doi:[10.2307/1931034][5]. | ||
(1954): 445–453, doi:[10.2307/1931034][10]. | ||
### Parameters | ||
* `dataset` **[FeatureCollection][3]\<any>** FeatureCollection (pref. of points) to study | ||
* `options` **[Object][6]** Optional parameters (optional, default `{}`) | ||
* `dataset` **[FeatureCollection][8]\<any>** FeatureCollection (pref. of points) to study | ||
* `options` **[Object][1]** Optional parameters (optional, default `{}`) | ||
* `options.studyArea` **[Feature][7]<[Polygon][8]>?** polygon representing the study area | ||
* `options.units` **[string][9]** unit of measurement for distances and, squared, area. (optional, default `'kilometers'`) | ||
* `options.properties` **[Object][6]** properties (optional, default `{}`) | ||
* `options.studyArea` **[Feature][4]<[Polygon][6]>?** polygon representing the study area | ||
* `options.properties` **[GeoJsonProperties][4]** properties (optional, default `{}`) | ||
@@ -66,22 +91,26 @@ ### Examples | ||
Returns **[Feature][7]<[Polygon][8]>** A polygon of the study area or an approximation of one. | ||
Returns **[NearestNeighborStudyArea][11]** A polygon of the study area or an approximation of one. | ||
[1]: Feature<Polygon> | ||
[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object | ||
[2]: https://en.wikipedia.org/wiki/Standard_score | ||
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String | ||
[3]: https://tools.ietf.org/html/rfc7946#section-3.3 | ||
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number | ||
[4]: https://tools.ietf.org/html/rfc7946#section-3.1.2 | ||
[4]: https://tools.ietf.org/html/rfc7946#section-3.2 | ||
[5]: http://doi.org/10.2307/1931034 | ||
[5]: #nearestneighborstatistics | ||
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object | ||
[6]: https://tools.ietf.org/html/rfc7946#section-3.1.6 | ||
[7]: https://tools.ietf.org/html/rfc7946#section-3.2 | ||
[7]: https://en.wikipedia.org/wiki/Standard_score | ||
[8]: https://tools.ietf.org/html/rfc7946#section-3.1.6 | ||
[8]: https://tools.ietf.org/html/rfc7946#section-3.3 | ||
[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String | ||
[9]: https://tools.ietf.org/html/rfc7946#section-3.1.2 | ||
[10]: http://doi.org/10.2307/1931034 | ||
[11]: #nearestneighborstudyarea | ||
<!-- This file is automatically generated. Please don't edit it directly. If you find an error, edit the source file of the module in question (likely index.js or index.ts), and re-run "yarn docs" from the root of the turf project. --> | ||
@@ -88,0 +117,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35725
198
130
Updated@turf/area@^7.2.0
Updated@turf/bbox@^7.2.0
Updated@turf/bbox-polygon@^7.2.0
Updated@turf/centroid@^7.2.0
Updated@turf/distance@^7.2.0
Updated@turf/helpers@^7.2.0
Updated@turf/meta@^7.2.0
Updated@turf/nearest-point@^7.2.0
Updatedtslib@^2.8.1