@turf/moran-index
Advanced tools
Comparing version 6.0.0 to 6.0.1
@@ -1,2 +0,2 @@ | ||
import { FeatureCollection } from '@turf/helpers'; | ||
import { FeatureCollection } from "@turf/helpers"; | ||
/** | ||
@@ -25,2 +25,3 @@ * Moran's I measures patterns of attribute values associated with features. | ||
* | ||
* @name moranIndex | ||
* @param {FeatureCollection<any>} fc | ||
@@ -37,10 +38,10 @@ * @param {Object} options | ||
* | ||
* const pointJson = load.sync('./test/in/point.json'); | ||
* const result = moranIndex(pointJson, { | ||
* const bbox = [-65, 40, -63, 42]; | ||
* const dataset = turf.randomPoint(100, { bbox: bbox }); | ||
* | ||
* const result = turf.moranIndex(dataset, { | ||
* inputField: 'CRIME', | ||
* }); | ||
* console.log(result.moranIndex); | ||
* | ||
*/ | ||
export default function moranIndex(fc: FeatureCollection<any>, options: { | ||
export default function (fc: FeatureCollection<any>, options: { | ||
inputField: string; | ||
@@ -47,0 +48,0 @@ threshold?: number; |
23
index.js
@@ -31,2 +31,3 @@ "use strict"; | ||
* | ||
* @name moranIndex | ||
* @param {FeatureCollection<any>} fc | ||
@@ -43,10 +44,10 @@ * @param {Object} options | ||
* | ||
* const pointJson = load.sync('./test/in/point.json'); | ||
* const result = moranIndex(pointJson, { | ||
* const bbox = [-65, 40, -63, 42]; | ||
* const dataset = turf.randomPoint(100, { bbox: bbox }); | ||
* | ||
* const result = turf.moranIndex(dataset, { | ||
* inputField: 'CRIME', | ||
* }); | ||
* console.log(result.moranIndex); | ||
* | ||
*/ | ||
function moranIndex(fc, options) { | ||
function default_1(fc, options) { | ||
var inputField = options.inputField; | ||
@@ -59,7 +60,7 @@ var threshold = options.threshold || 100000; | ||
var weight = distance_weight_1.default(fc, { | ||
threshold: threshold, | ||
alpha: alpha, | ||
binary: binary, | ||
p: p, | ||
binary: binary, | ||
alpha: alpha, | ||
standardization: standardization, | ||
threshold: threshold, | ||
}); | ||
@@ -99,4 +100,4 @@ var y = []; | ||
return { | ||
expectedMoranIndex: expectedMoranIndex, | ||
moranIndex: moranIndex, | ||
expectedMoranIndex: expectedMoranIndex, | ||
stdNorm: stdNorm, | ||
@@ -106,3 +107,3 @@ zNorm: zNorm, | ||
} | ||
exports.default = moranIndex; | ||
exports.default = default_1; | ||
/** | ||
@@ -143,2 +144,2 @@ * get mean of a list | ||
* @property {number} zNorm the z-score of the observe samples with regard to the random distribution | ||
*/ | ||
*/ |
{ | ||
"name": "@turf/moran-index", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"description": "turf moran-index module", | ||
@@ -9,3 +9,2 @@ "main": "index", | ||
"index.js", | ||
"index.ts", | ||
"index.d.ts" | ||
@@ -39,6 +38,8 @@ ], | ||
"benchmark": "*", | ||
"rollup": "*", | ||
"write-json-file": "*", | ||
"load-json-file": "*", | ||
"tape": "*" | ||
"tape": "*", | ||
"typescript": "*", | ||
"tslint": "*", | ||
"@types/tape": "*" | ||
}, | ||
@@ -45,0 +46,0 @@ "dependencies": { |
@@ -43,7 +43,8 @@ # @turf/moran-index | ||
```javascript | ||
const pointJson = load.sync('./test/in/point.json'); | ||
const result = moranIndex(pointJson, { | ||
const bbox = [-65, 40, -63, 42]; | ||
const dataset = turf.randomPoint(100, { bbox: bbox }); | ||
const result = moranIndex(pts, { | ||
inputField: 'CRIME', | ||
}); | ||
console.log(result.moranIndex); | ||
``` | ||
@@ -50,0 +51,0 @@ |
108
13550
7
5
195