@@ -553,7 +553,7 @@ def w_local_cluster(w):
553553 neighbors of observation :math:`i` are to being a clique:
554554
555555 .. math::
556-
556+
557557 c_i = | \{w_{j,k}\} |/ (k_i(k_i - 1)): j,k \in N_i
558558
559559 where :math:`N_i` is the set of neighbors to :math:`i`, :math:`k_i =
@@ -1454,7 +1454,7 @@ def nonplanar_neighbors(w, geodataframe, tolerance=0.001, **kwargs):
14541454 return w
14551455
14561456@requires ('geopandas' )
1457- def fuzzy_contiguity (gdf , tolerance = 0.005 , buffering = False , drop = True , ** kwargs ):
1457+ def fuzzy_contiguity (gdf , tolerance = 0.005 , buffering = False , drop = True , buffer = None , ** kwargs ):
14581458 """
14591459 Fuzzy contiguity spatial weights
14601460
@@ -1472,6 +1472,10 @@ def fuzzy_contiguity(gdf, tolerance=0.005, buffering=False, drop=True, **kwargs)
14721472
14731473 drop: boolean
14741474 If True (default), the buffered features are removed from the GeoDataFrame. If False, buffered features are added to the GeoDataFrame.
1475+
1476+ buffer : float
1477+ Specify exact buffering distance. Ignores `tolerance`.
1478+
14751479 **kwargs: keyword arguments
14761480 optional arguments for :class:`pysal.weights.W`
14771481
@@ -1545,11 +1549,12 @@ def fuzzy_contiguity(gdf, tolerance=0.005, buffering=False, drop=True, **kwargs)
15451549
15461550 """
15471551 if buffering :
1548- # buffer each shape
1549- minx , miny , maxx , maxy = gdf .total_bounds
1550- buffer = tolerance * 0.5 * abs (min (maxx - minx , maxy - miny ))
1552+ if not buffer :
1553+ # buffer each shape
1554+ minx , miny , maxx , maxy = gdf .total_bounds
1555+ buffer = tolerance * 0.5 * abs (min (maxx - minx , maxy - miny ))
15511556 # create new geometry column
1552- new_geometry = gpd . GeoSeries ([ feature .buffer (buffer ) for feature in gdf . geometry ] )
1557+ new_geometry = gdf . geometry .buffer (buffer )
15531558 gdf ['_buffer' ] = new_geometry
15541559 old_geometry_name = gdf .geometry .name
15551560 gdf .set_geometry ('_buffer' , inplace = True )
0 commit comments