addBinaryDistanceBandColumn()
Annotates a dataframe with a weights column for each data record containing the other members within the threshold and their weight.
Parameters
DataFrame with geometry column
Distance threshold for considering neighbors
Whether to include neighbors that are 0 distance. If 0 distance neighbors are included and binary is false, values are infinity as per the floating point spec (divide by 0)
Whether to include self in the list of neighbors
Name of the geometry column
Whether to use a cartesian or spheroidal distance calculation. Default is false
The attributes to save in the neighbor column. Default is all columns
The name of the resulting column. Default is ‘weights’
Returns
The input DataFrame with a weight column added containing neighbors and their weights (always 1) added to each row
addDistanceBandColumn()
Annotates a dataframe with a weights column for each data record containing the other members within the threshold and their weight.
Parameters
DataFrame with geometry column
Distance threshold for considering neighbors
Whether to use binary weights or inverse distance weights for neighbors (dist^alpha)
Alpha to use for inverse distance weights ignored when binary is true
Whether to include neighbors that are 0 distance. If 0 distance neighbors are included and binary is false, values are infinity as per the floating point spec (divide by 0)
Whether to include self in the list of neighbors
The value to use for the self weight
Name of the geometry column
Whether to use a cartesian or spheroidal distance calculation. Default is false
The attributes to save in the neighbor column. Default is all columns
The name of the resulting column. Default is ‘weights’
Returns
The input DataFrame with a weight column added containing neighbors and their weights added to each row
addWeightedDistanceBandColumn()
Annotates a dataframe with a weights column for each data record containing the other members within the threshold and their weight.
Parameters
DataFrame with geometry column
Distance threshold for considering neighbors
Alpha to use for inverse distance weights. Computation is dist^alpha. Default is -1.0
Whether to include neighbors that are 0 distance. If 0 distance neighbors are included and binary is false, values are infinity as per the floating point spec (divide by 0)
Whether to include self in the list of neighbors
The weight to provide for the self as its own neighbor. Default is 1.0
Name of the geometry column
Whether to use a cartesian or spheroidal distance calculation. Default is false
The attributes to save in the neighbor column. Default is all columns
The name of the resulting column. Default is ‘weights’
Returns
The input DataFrame with a weight column added containing neighbors and their weights (dist^alpha) added to each row
Usage Examples
Weight Types
Binary Weights
Binary weights assign a value of 1.0 to all neighbors within the threshold distance and 0.0 to all others. This is the simplest form of spatial weighting.Inverse Distance Weights
Inverse distance weights use the formuladist^alpha where alpha is typically negative (e.g., -1.0 or -2.0). Closer neighbors receive higher weights, and farther neighbors receive lower weights.
Distance Band Weights
Distance band weights can be either binary or inverse distance based, depending on thebinary parameter. This provides flexibility in choosing the weighting scheme.
Notes
- All methods require a DataFrame with at least one geometry column
- Rows in the DataFrame must be unique
- If multiple geometry columns exist and none is named ‘geometry’, the column name must be specified
- The
useSpheroidparameter determines whether to use Cartesian (planar) or spheroidal (great circle) distance calculations - Zero distance neighbors can cause infinite weights when using inverse distance weighting

