libpysal.weights.vecW(origin_x, origin_y, dest_x, dest_y, threshold, p=2, alpha=-1.0, binary=True, ids=None, build_sp=False, silence_warnings=False)[source]¶Distance-based spatial weight for vectors that is computed using a 4-dimensional distance between the origin x,y-coordinates and the destination x,y-coordinates
| Parameters: | origin_x : list or array
origin_y : list or array
dest_x : list or array
dest_y : list or array
threshold : float
p : float
binary : boolean
alpha : float
ids : list
build_sp : boolean
silence_warnings : boolean
Returns —— W : DistanceBand W object that uses 4-dimenional distances between
|
|---|
Examples
>>> import libpysal
>>> x1 = [5,6,3]
>>> y1 = [1,8,5]
>>> x2 = [2,4,9]
>>> y2 = [3,6,1]
>>> W1 = libpysal.weights.spintW.vecW(x1, y1, x2, y2, threshold=999)
>>> list(W1.neighbors[0])
[1, 2]
>>> W2 = libpysal.weights.spintW.vecW(x1, y2, x1, y2, threshold=8.5)
>>> list(W2.neighbors[0])
[1, 2]