The weights.Contiguity. module provides for the construction and manipulation of spatial weights matrices based on contiguity criteria.
New in version 1.0.
Contiguity based spatial weights
Build contiguity weights from a source
| Parameters: | polygons : an instance of a pysal geo file handler
criterion : string
ids : list
|
|---|---|
| Returns: | w : W instance
Examples : ——- : >>> w = buildContiguity(pysal.open(‘../examples/10740.shp’,’r’)) : >>> w[0] : {1: 1.0, 4: 1.0, 101: 1.0, 85: 1.0, 5: 1.0} : >>> w = buildContiguity(pysal.open(‘../examples/10740.shp’,’r’),criterion=’queen’) : >>> w.pct_nonzero : 0.031926364234056544 : >>> w = buildContiguity(pysal.open(‘../examples/10740.shp’,’r’),criterion=’rook’) : >>> w.pct_nonzero : 0.026351084812623275 : >>> fips = pysal.open(‘../examples/10740.dbf’).by_col(‘STFID’) : >>> w = buildContiguity(pysal.open(‘../examples/10740.shp’,’r’),ids=fips) : >>> w[‘35001000107’] : {‘35001003805’: 1.0, ‘35001003721’: 1.0, ‘35001000111’: 1.0, ‘35001000112’: 1.0, ‘35001000108’: 1.0} : |
See also
Notes
The types of sources supported will expand over time.