Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
w = isWeighted ? (current.properties[weight] || 0) : 1,
c = getCoord(current).map((a, i) => Math.pow(w * a - m[i], 2));
return prev.map((a, i) => a + c[i]);
}, [0, 0]),
degDist = Math.sqrt((_sum[0] + _sum[1]) / pointsCount);
return radiansToLength(degreesToRadians(degDist), 'kilometers') / latCorrection;
};
// find collection's centroid
if (weight === undefined || weight.length === 0) {
mc = centroid(output, {
'weight': null
});
} else {
let
mw = propReduce(output, (prev, current) => prev + current[weight] * 1, 0),
_weighted = featureReduce(output, (prev, current) => {
const
w = current.properties[weight],
c = getCoord(current).map(a => a * w / mw);
return prev.map((a, i) => a + c[i]);
}, [0, 0]);
mc = point(_weighted, {
'weight': mw
});
}
// calc the median distance from the centroid to each point (km)
dists = featureReduce(output, (prev, current) => {
prev.push(distance(current, mc));
}, []);
median = _getMedian(dists);
// calc the standard distance (pseudo-km)