Contiguity-Based Weights

Spatial weights represent the possible spatial interaction between observations in space. They are an essential element in the construction of spatial autocorrelation statistics and provide the means to create spatially explicit variables, such as spatially lagged variables and spatially smoothed rates. For more information, please read: https://geodacenter.github.io/workbook/4a_contig_weights/lab4a.html

Contiguity means that two spatial units share a common border of non-zero length. Operationally, we can further distinguish between a rook and a queen criterion of contiguity, in analogy to the moves allowed for the such-named pieces on a chess board.

The rook criterion defines neighbors by the existence of a common edge between two spatial units. The queen criterion is somewhat more encompassing and defines neighbors as spatial units sharing a common edge or a common vertex.

For more information, please read: https://geodacenter.github.io/workbook/4a_contig_weights/lab4a.html

1. getQueenWeights()

function getQueenWeights(
    String  mapUid,
    Number  ord, 
    Boolean includeLowerOrder, 
    Number  precisionThreshold);

Arguments

Input Arguments

Type

Description

mapUid

String

the unique map id

ord

Number

order of contiguity. Default is 1.

includeLowerOrder

Boolean

boolean value indicates whether or not the lower order neighbors should be included in the weights structure. Default is FALSE.

precisionThreshold

Number

(for polygons only) the distance of precision to determine which polygons are neighbors when the underlying geometries are insufficient to allow for an exact match of coordinates. Default is 0.0.

Return

Value

Description

WeightsResult

the weights structure for each observation.

Examples

const jsgeoda = require('jsgeoda');
const fs = require('fs');

// load data
const data = fs.readFileSync('./data/natregimes.geojson').buffer;

// create jsgeoda instance
const geoda = await jsgeoda.New();

// load geojson in jsgeoda
const nat = geoda.readGeoJSON(data);

// create a queen contiguity weights
const w = geoda.getQueenWeights(nat);

// create connectivity graph 
const arcs = geoda.getConnectivity(nat, w);

2. getRookWeights()

function getRookWeights(
    String  map_uid,
    Number  ord, 
    Boolean include_lowerorder, 
    Number   precision_threshold)

Try it yourself in the playground (jsgeoda + deck.gl):

Last updated