import { SpatialGeometry } from '../geometry/utils'; import { WeightsMeta } from './weights-stats'; export type CreateWeightsProps = { weightsType: 'knn' | 'threshold' | 'queen' | 'rook' | 'kernel'; k?: number; distanceThreshold?: number; isQueen?: boolean; isRook?: boolean; isMile?: boolean; /** * The bandwidth for kernel weights */ bandwidth?: number; /** * The kernel function for kernel weights */ kernel?: string; /** * Whether the diagonal (self) weight is kernel(1.0) instead of 1.0 */ useKernelDiagonals?: boolean; /** * The power (or exponent) applied to the distance before normalizing by the bandwidth */ power?: number; /** * Whether to use centroids for neighbor calculations */ useCentroids?: boolean; /** * The precision threshold for neighbor calculations */ precisionThreshold?: number; /** * The order of contiguity for neighbor calculations */ orderOfContiguity?: number; /** * Whether to include lower order neighbors */ includeLowerOrder?: boolean; /** * The geometries to create the weights for. See {@link SpatialGeometry} for more information. * - GeoJSON features: {@link Feature} from geojson * - Binary feature collection: {@link BinaryFeatureCollection} from loaders.gl/schema * - Point layer data: {@link PointLayerData} from kepler.gl * - Arc layer data: {@link ArcLayerData} from kepler.gl * - Hexagon id layer data: {@link HexagonIdLayerData} from kepler.gl */ geometries: SpatialGeometry; }; /** * 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); * ``` */ export declare function createWeights({ weightsType, k, isQueen, distanceThreshold, isMile, bandwidth, kernel, useKernelDiagonals, power, useCentroids, precisionThreshold, orderOfContiguity, includeLowerOrder, geometries, }: CreateWeightsProps): Promise<{ weights: number[][]; weightsMeta: WeightsMeta; }>;