geodalib / core/src / createWeights
Function: createWeights()
createWeights(
__namedParameters
):Promise
<{weights
:number
[][];weightsMeta
:WeightsMeta
; }>
Defined in: core/src/weights/utils.ts:63
Create weights for the given geometries.
Example
ts
import { createWeights } from '@geoda/core';
const geometries = [
{ type: 'Feature', geometry: { type: 'Point', coordinates: [0, 0] } },
{ type: 'Feature', geometry: { type: 'Point', coordinates: [1, 0] } },
{ type: 'Feature', geometry: { type: 'Point', coordinates: [0, 1] } },
];
const weights = await createWeights({
weightsType: 'queen',
geometries,
});
console.log(weights);
Parameters
__namedParameters
Returns
Promise
<{ weights
: number
[][]; weightsMeta
: WeightsMeta
; }>