Session.filter#

Session.filter(geometries, prop_name, lower=None, upper=None, include=None, exclude=None, **kwargs)[source]#

Filter geometries by property value range or membership.

Automatically detects whether the property yields per-vertex arrays (point-level filtering) or scalars (population-level filtering). Range operators (lower / upper) and membership operators (include / exclude) may be combined; they are AND-ed.

Parameters:
geometrieslist of Geometry

Target geometries.

prop_namestr

Vertex property name or measure name.

lowerfloat, optional

Lower bound (inclusive). Numeric properties only.

upperfloat, optional

Upper bound (inclusive). Numeric properties only.

includescalar, sequence, or np.ndarray, optional

Keep only values present in this set. Works for any dtype.

excludescalar, sequence, or np.ndarray, optional

Remove values present in this set. Works for any dtype.

**kwargs

Additional parameters passed to property computation.

Returns:
tuple of (int, int, str)

(kept, removed, level) where level is "point" or "population".

Raises:
TypeError

If lower or upper is supplied for a non-numeric property.