How to use the @turf/distance-weight function in @turf/distance-weight

To help you get started, we’ve selected a few @turf/distance-weight examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Turfjs / turf / packages / turf-moran-index / index.ts View on Github external
standardization?: boolean;
}): {
        moranIndex: number;
        expectedMoranIndex: number;
        stdNorm: number;
        zNorm: number;
    } {

    const inputField = options.inputField;
    const threshold = options.threshold || 100000;
    const p = options.p || 2;
    const binary = options.binary || false;
    const alpha = options.alpha || -1;
    const standardization = options.standardization || true;

    const weight = spatialWeight(fc, {
        threshold,
        p,
        binary,
        alpha,
        standardization,
    });

    const y: number[] = [];
    featureEach(fc, (feature) => {
        const feaProperties = feature.properties || {};
        // validate inputField exists
        y.push(feaProperties[inputField]);
    });

    const yMean = mean(y);
    const yVar = variance(y);

@turf/distance-weight

turf distance-weight module

MIT
Latest version published 3 months ago

Package Health Score

94 / 100
Full package analysis

Popular @turf/distance-weight functions