Skip to content

geodalib / core/src / queenWeights

Function: queenWeights()

queenWeights(geometries, useCentroids?, precisionThreshold?, orderOfContiguity?, includeLowerOrder?): Promise<WeightsMeta>

Defined in: core/src/weights/contiguity-neighbors.ts:208

Description

Create Queen contiguity weights for GeoJSON features.

Queen contiguity defines neighbors as spatial units that share either:

  • A common edge (border)
  • A common vertex (corner)

This is in contrast to Rook contiguity, which only considers shared edges.

Parameters

geometries

SpatialGeometry

The geometries used to create the queen contiguity weights. See SpatialGeometry for more information.

useCentroids?

boolean = false

If true, uses geometry centroids for calculations

precisionThreshold?

number = 0.0

Distance threshold for determining neighbors. Useful when geometries don't perfectly align

orderOfContiguity?

number = 1

Number of steps to consider for neighbor relationships. 1 means immediate neighbors only

includeLowerOrder?

boolean = false

If true, includes all neighbors from order 1 up to the specified order

Returns

Promise<WeightsMeta>

Spatial weights metadata including neighbor relationships