# libpysal.weights.vecW

libpysal.weights.vecW(origin_x, origin_y, dest_x, dest_y, threshold, p=2, alpha=-1.0, binary=True, ids=None, build_sp=False, **kwargs)

  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 `python:list` or `array`

      of vector origin x-coordinates

    origin_y `python:list` or `array`

      of vector origin y-coordinates

    dest_x `python:list` or `array`

      of vector destination x-coordinates

    dest_y `python:list` or `array`

      of vector destination y-coordinates

    threshold `python:float`

      distance band

    p `python:float`

      Minkowski p-norm distance metric parameter: 1<=p<=infinity 2: Euclidean distance 1: Manhattan distance

    binary bool

      If true w_{ij}=1 if d_{i,j}<=threshold, otherwise w_{i,j}=0 If false wij=dij^{alpha}

    alpha `python:float`

      distance decay parameter for weight (default -1.0) if alpha is positive the weights will not decline with distance. If binary is True, alpha is ignored

    ids `python:list`

      values to use for keys of the neighbors and weights dicts

    build_sp bool

      True to build sparse distance matrix and false to build dense distance matrix; significant speed gains may be obtained dending on the sparsity of the of distance_matrix and threshold that is applied

    **kwargs `keyword` `arguments`

      optional arguments for `pysal.weights.W`

  Returns:
    w `DistanceBand` `W` `object` `that` `uses` 4-dimenional `distances` `between`

      vectors origin and destination coordinates.

  Examples

      >>> import libpysal
      >>> x1 = [5,6,3]
      >>> y1 = [1,8,5]
      >>> x2 = [2,4,9]
      >>> y2 = [3,6,1]
      >>> W1 = libpysal.weights.vecW(x1, y1, x2, y2, threshold=999)
      >>> list(W1.neighbors[0])
      [1, 2]
      >>> W2 = libpysal.weights.vecW(x1, y2, x1, y2, threshold=8.5)
      >>> list(W2.neighbors[0])
      [1, 2]