- class momepy.DistanceBand(gdf, threshold, centroid=True, ids=None)[source]#
On demand distance-based spatial weights-like class.
Mimic the behavior of
libpysal.weights.DistanceBandbut do not compute all neighbors at once; only on demand. Only
DistanceBand.neighbors[key]is implemented. Once a user asks for
DistanceBand.neighbors[key], neighbors for specified key will be computed using
rtree. The algorithm is significantly slower than
libpysal.weights.DistanceBandbut allows for a large number of neighbors which may cause memory issues in libpysal.
momepy.weights.DistanceBandonly when necessary.
DistanceBand.neighbors[key]should yield the same results as
- gdfGeoDataFrame or GeoSeries
The GeoDataFrame containing objects to be used.
The distance band to be used as buffer.
- centroidbool (default True)
Use the centroid of geometries (as in
False, this works with the geometry as it is.
The column to be used as geometry IDs. If not set, integer position is used.
A list of IDs of neighboring features.
__init__(gdf, threshold[, centroid, ids])