Skip to content

fastquadtree.Item

Bases: Generic[G]

Generic container for quadtree index entries.

This class provides a lightweight wrapper around spatial index entries, containing an ID, geometry, and optional associated Python object.

Attributes:

Name Type Description
id_ int

Integer identifier for this entry.

geom G

Geometry data (Point or Bounds depending on tree type).

obj Any | None

Associated Python object, or None if not set.

id_ = id_ instance-attribute

geom = geom instance-attribute

obj = obj instance-attribute

to_dict()

Serialize the item to a dictionary.

Returns:

Type Description
dict[str, Any]

Dictionary with 'id', 'geom', and 'obj' keys.

from_dict(data) classmethod

Deserialize an item from a dictionary.

Parameters:

Name Type Description Default
data dict[str, Any]

Dictionary with 'id', 'geom', and 'obj' keys.

required

Returns:

Type Description
Item

Item instance populated with the deserialized data.