<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Foundations / Spatial on Ometeotl, an abstract decision meta-model</title><link>https://kakchouch.github.io/ometeotl/documentation/class-reference/foundations/spatial/</link><description>Recent content in Foundations / Spatial on Ometeotl, an abstract decision meta-model</description><generator>Hugo</generator><language>en-us</language><atom:link href="https://kakchouch.github.io/ometeotl/documentation/class-reference/foundations/spatial/index.xml" rel="self" type="application/rss+xml"/><item><title>BoundingBox</title><link>https://kakchouch.github.io/ometeotl/documentation/class-reference/foundations/spatial/bounding-box/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kakchouch.github.io/ometeotl/documentation/class-reference/foundations/spatial/bounding-box/</guid><description>&lt;p&gt;Source:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/kakchouch/ometeotl/blob/main/src/ometeotl_foundations/spatial/bounding_box.py"&gt;src/ometeotl_foundations/spatial/bounding_box.py&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Local role:
Pure-Python, frozen-dataclass implementation of the &lt;code&gt;Geometry&lt;/code&gt; protocol. The only concrete geometry at the foundations layer — makes the spatial module fully usable without any adapter.&lt;/p&gt;
&lt;p&gt;Big-picture role:
Used as the geometry type &lt;code&gt;G&lt;/code&gt; for &lt;code&gt;GeometricSpace[BoundingBox]&lt;/code&gt;, &lt;code&gt;SpatialExtent[BoundingBox]&lt;/code&gt;, and &lt;code&gt;SpatialMap[BoundingBox]&lt;/code&gt; when no adapter is installed. Adapter-backed geometry types must expose a &lt;code&gt;.bounds&lt;/code&gt; property that returns a &lt;code&gt;BoundingBox&lt;/code&gt;, enabling fallback comparisons.&lt;/p&gt;
&lt;h2 id="fields"&gt;Fields&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;min_x: float&lt;/code&gt; — left boundary&lt;/li&gt;
&lt;li&gt;&lt;code&gt;min_y: float&lt;/code&gt; — bottom boundary&lt;/li&gt;
&lt;li&gt;&lt;code&gt;max_x: float&lt;/code&gt; — right boundary&lt;/li&gt;
&lt;li&gt;&lt;code&gt;max_y: float&lt;/code&gt; — top boundary&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Raises &lt;code&gt;ValueError&lt;/code&gt; on construction if &lt;code&gt;min_x &amp;gt; max_x&lt;/code&gt; or &lt;code&gt;min_y &amp;gt; max_y&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>Coordinate2D / Coordinate3D / GeoCoordinate / GridCell</title><link>https://kakchouch.github.io/ometeotl/documentation/class-reference/foundations/spatial/coordinates/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kakchouch.github.io/ometeotl/documentation/class-reference/foundations/spatial/coordinates/</guid><description>&lt;p&gt;Source:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/kakchouch/ometeotl/blob/main/src/ometeotl_foundations/spatial/coordinates.py"&gt;src/ometeotl_foundations/spatial/coordinates.py&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Local role:
Pure immutable value types for expressing positions. No geometry logic — arithmetic, distance, and projection belong to &lt;code&gt;Geometry&lt;/code&gt; implementations.&lt;/p&gt;
&lt;h2 id="coordinate2d"&gt;Coordinate2D&lt;/h2&gt;
&lt;p&gt;Frozen dataclass. A position in a flat 2-D Cartesian or projected plane.&lt;/p&gt;
&lt;p&gt;Fields:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;x: float&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;y: float&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="coordinate3d"&gt;Coordinate3D&lt;/h2&gt;
&lt;p&gt;Frozen dataclass. A position in a 3-D Cartesian space.&lt;/p&gt;
&lt;p&gt;Fields:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;x: float&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;y: float&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;z: float&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="geocoordinate"&gt;GeoCoordinate&lt;/h2&gt;
&lt;p&gt;Frozen dataclass. A geographic position in the GeoJSON longitude/latitude convention.&lt;/p&gt;
&lt;p&gt;Fields:&lt;/p&gt;</description></item><item><title>CoordinateKind / CoordinateSystem / Predefined Singletons</title><link>https://kakchouch.github.io/ometeotl/documentation/class-reference/foundations/spatial/coordinate-system/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kakchouch.github.io/ometeotl/documentation/class-reference/foundations/spatial/coordinate-system/</guid><description>&lt;p&gt;Source:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/kakchouch/ometeotl/blob/main/src/ometeotl_foundations/spatial/coordinate_system.py"&gt;src/ometeotl_foundations/spatial/coordinate_system.py&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Local role:
Vocabulary for describing coordinate frames attached to geometries and spatial extents.&lt;/p&gt;
&lt;h2 id="coordinatekind"&gt;CoordinateKind&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;str, Enum&lt;/code&gt;. Nature of a coordinate system. Inherits from &lt;code&gt;str&lt;/code&gt; so values serialise to their string form without a custom JSON encoder.&lt;/p&gt;
&lt;p&gt;Values:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CARTESIAN = &amp;quot;cartesian&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;GEOGRAPHIC = &amp;quot;geographic&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;GRID = &amp;quot;grid&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;CUSTOM = &amp;quot;custom&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="coordinatesystem"&gt;CoordinateSystem&lt;/h2&gt;
&lt;p&gt;Frozen dataclass. Describes the coordinate frame used by a geometry or extent.&lt;/p&gt;
&lt;p&gt;Fields:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;name: str&lt;/code&gt; — human-readable identifier (e.g. &lt;code&gt;&amp;quot;wgs84&amp;quot;&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kind: CoordinateKind&lt;/code&gt; — broad category&lt;/li&gt;
&lt;li&gt;&lt;code&gt;unit: str&lt;/code&gt; — native unit of measure (&lt;code&gt;&amp;quot;meter&amp;quot;&lt;/code&gt;, &lt;code&gt;&amp;quot;degree&amp;quot;&lt;/code&gt;, &lt;code&gt;&amp;quot;cell&amp;quot;&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;srid: Optional[int] = None&lt;/code&gt; — EPSG code for geographic/projected systems&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Methods:&lt;/p&gt;</description></item><item><title>derive_space_relations</title><link>https://kakchouch.github.io/ometeotl/documentation/class-reference/foundations/spatial/relation-derivation/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kakchouch.github.io/ometeotl/documentation/class-reference/foundations/spatial/relation-derivation/</guid><description>&lt;p&gt;Source:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/kakchouch/ometeotl/blob/main/src/ometeotl_foundations/spatial/relation_derivation.py"&gt;src/ometeotl_foundations/spatial/relation_derivation.py&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Local role:
Bridge function from the spatial foundations layer back to &lt;code&gt;ometeotl_core&lt;/code&gt;. Compares geometries pairwise and populates a &lt;code&gt;SpaceRelationGraph&lt;/code&gt; with the resulting topological relations.&lt;/p&gt;
&lt;p&gt;Big-picture role:
Closes the loop from concrete geometry back to the abstract core model. The caller passes &lt;code&gt;GeometricSpace&lt;/code&gt; objects (which carry both &lt;code&gt;space.id&lt;/code&gt; and &lt;code&gt;geometry&lt;/code&gt;) and receives a &lt;code&gt;SpaceRelationGraph&lt;/code&gt; ready for use in world-level reasoning.&lt;/p&gt;
&lt;h2 id="signature"&gt;Signature&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;def&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;derive_space_relations&lt;/span&gt;(
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; spaces: Iterable[GeometricSpace],
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;*&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; skip_abstract: bool &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;True&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; adjacency_tolerance: float &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0.0&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; derive_containment: bool &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;True&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; derive_intersection: bool &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;True&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; derive_adjacency: bool &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;True&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;) &lt;span style="color:#f92672"&gt;-&amp;gt;&lt;/span&gt; SpaceRelationGraph:
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="algorithm"&gt;Algorithm&lt;/h2&gt;
&lt;p&gt;For each unordered pair (A, B) the function checks in priority order:&lt;/p&gt;</description></item><item><title>GeometricSpace</title><link>https://kakchouch.github.io/ometeotl/documentation/class-reference/foundations/spatial/geometric-space/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kakchouch.github.io/ometeotl/documentation/class-reference/foundations/spatial/geometric-space/</guid><description>&lt;p&gt;Source:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/kakchouch/ometeotl/blob/main/src/ometeotl_foundations/spatial/geometric_space.py"&gt;src/ometeotl_foundations/spatial/geometric_space.py&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Local role:
Frozen generic dataclass that composes a core &lt;code&gt;Space&lt;/code&gt; with a concrete geometry. The primary user-facing type for spatial spaces in the foundations layer.&lt;/p&gt;
&lt;p&gt;Big-picture role:
&lt;code&gt;GeometricSpace[G]&lt;/code&gt; answers both ontological questions (kind, is_abstract, dimensions) and spatial questions (geometry) through a single object, without touching the &lt;code&gt;Space&lt;/code&gt; dataclass directly. It is the input type for &lt;code&gt;derive_space_relations()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Design principle: &lt;strong&gt;composition over inheritance&lt;/strong&gt; — &lt;code&gt;GeometricSpace&lt;/code&gt; wraps &lt;code&gt;Space&lt;/code&gt; rather than subclassing it. This avoids dataclass + Generic[G] inheritance pitfalls and keeps &lt;code&gt;ometeotl_core&lt;/code&gt; untouched.&lt;/p&gt;</description></item><item><title>Geometry Protocol</title><link>https://kakchouch.github.io/ometeotl/documentation/class-reference/foundations/spatial/geometry/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kakchouch.github.io/ometeotl/documentation/class-reference/foundations/spatial/geometry/</guid><description>&lt;p&gt;Source:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/kakchouch/ometeotl/blob/main/src/ometeotl_foundations/spatial/geometry.py"&gt;src/ometeotl_foundations/spatial/geometry.py&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Local role:
Structural &lt;code&gt;Protocol&lt;/code&gt; (PEP 544) that all geometry implementations must satisfy. Decorated with &lt;code&gt;@runtime_checkable&lt;/code&gt; so &lt;code&gt;isinstance(obj, Geometry)&lt;/code&gt; guards work at runtime.&lt;/p&gt;
&lt;p&gt;Big-picture role:
The contract between the spatial foundations layer and adapter backends. &lt;code&gt;BoundingBox&lt;/code&gt; satisfies it at the foundations layer; the Shapely adapter will wrap &lt;code&gt;shapely.geometry.*&lt;/code&gt; objects in a thin class that also satisfies it.&lt;/p&gt;
&lt;h2 id="protocol-members"&gt;Protocol members&lt;/h2&gt;
&lt;p&gt;Properties:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;area -&amp;gt; float&lt;/code&gt; — area in the native units of the coordinate system; 0 for point/line geometries&lt;/li&gt;
&lt;li&gt;&lt;code&gt;centroid -&amp;gt; Coordinate2D&lt;/code&gt; — geometric centroid as a 2-D coordinate&lt;/li&gt;
&lt;li&gt;&lt;code&gt;bounds -&amp;gt; BoundingBox&lt;/code&gt; — axis-aligned bounding box of the geometry&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Methods:&lt;/p&gt;</description></item><item><title>SpatialBackend Protocol</title><link>https://kakchouch.github.io/ometeotl/documentation/class-reference/foundations/spatial/spatial-backend/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kakchouch.github.io/ometeotl/documentation/class-reference/foundations/spatial/spatial-backend/</guid><description>&lt;p&gt;Source:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/kakchouch/ometeotl/blob/main/src/ometeotl_foundations/spatial/spatial_backend.py"&gt;src/ometeotl_foundations/spatial/spatial_backend.py&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Local role:
&lt;code&gt;runtime_checkable&lt;/code&gt; Protocol defining the adapter factory interface. An adapter backend implements this protocol to expose library-backed geometry construction and spatial indexing to the rest of the system.&lt;/p&gt;
&lt;p&gt;Big-picture role:
The foundations layer itself does not provide a concrete backend — &lt;code&gt;BoundingBox&lt;/code&gt; is the pure-Python fallback geometry. The Shapely adapter (&lt;code&gt;ometeotl_adapters/spatial_shapely/&lt;/code&gt;) will implement this protocol using &lt;code&gt;shapely.geometry.*&lt;/code&gt; factories.&lt;/p&gt;
&lt;h2 id="protocol-members"&gt;Protocol members&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;make_point(coord: Coordinate2D) -&amp;gt; Geometry&lt;/code&gt; — create a point geometry from a 2-D coordinate&lt;/li&gt;
&lt;li&gt;&lt;code&gt;make_point_3d(coord: Coordinate3D) -&amp;gt; Geometry&lt;/code&gt; — create a point geometry from a 3-D coordinate&lt;/li&gt;
&lt;li&gt;&lt;code&gt;make_polygon(exterior: List[Coordinate2D]) -&amp;gt; Geometry&lt;/code&gt; — create a simple polygon from an exterior ring; backends close the ring internally if needed&lt;/li&gt;
&lt;li&gt;&lt;code&gt;make_buffer(geom: Geometry, distance: float) -&amp;gt; Geometry&lt;/code&gt; — return &lt;code&gt;geom&lt;/code&gt; expanded by &lt;code&gt;distance&lt;/code&gt; (in native units of the geometry&amp;rsquo;s coordinate system)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;make_bounding_box(min_x, min_y, max_x, max_y) -&amp;gt; Geometry&lt;/code&gt; — create a rectangular geometry from explicit AABB coordinates; may return a &lt;code&gt;BoundingBox&lt;/code&gt; or a library-specific rectangle&lt;/li&gt;
&lt;li&gt;&lt;code&gt;make_index() -&amp;gt; SpatialIndex&lt;/code&gt; — create an empty spatial index backed by this adapter&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="design-notes"&gt;Design notes&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Typed coordinate arguments (&lt;code&gt;Coordinate2D&lt;/code&gt;, &lt;code&gt;Coordinate3D&lt;/code&gt;) rather than variadic &lt;code&gt;*coords&lt;/code&gt; prevent arity bugs and preserve type-checker information.&lt;/li&gt;
&lt;li&gt;Construction operations (buffer, union) are on &lt;code&gt;SpatialBackend&lt;/code&gt;, not on the &lt;code&gt;Geometry&lt;/code&gt; protocol — geometry objects are value objects; the backend is the factory.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Example (illustrative — implementation lives in the adapter layer):&lt;/p&gt;</description></item><item><title>SpatialExtent</title><link>https://kakchouch.github.io/ometeotl/documentation/class-reference/foundations/spatial/spatial-extent/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kakchouch.github.io/ometeotl/documentation/class-reference/foundations/spatial/spatial-extent/</guid><description>&lt;p&gt;Source:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/kakchouch/ometeotl/blob/main/src/ometeotl_foundations/spatial/spatial_extent.py"&gt;src/ometeotl_foundations/spatial/spatial_extent.py&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Local role:
Frozen generic dataclass recording where a non-space object (actor, resource, etc.) is located within a named coordinate frame.&lt;/p&gt;
&lt;p&gt;Big-picture role:
Distinct from &lt;code&gt;GeometricSpace&lt;/code&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;GeometricSpace&lt;/code&gt;&lt;/strong&gt; describes what shape a &lt;em&gt;space&lt;/em&gt; IS.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;SpatialExtent&lt;/code&gt;&lt;/strong&gt; describes where an &lt;em&gt;object&lt;/em&gt; IS within a space.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;SpatialMap[G]&lt;/code&gt; maps &lt;code&gt;ObjectId → SpatialExtent[G]&lt;/code&gt; to track actor and resource positions.&lt;/p&gt;
&lt;h2 id="type-parameter"&gt;Type parameter&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;G&lt;/code&gt; — the concrete geometry type (e.g. &lt;code&gt;BoundingBox&lt;/code&gt;). Must satisfy the &lt;code&gt;Geometry&lt;/code&gt; protocol.&lt;/p&gt;
&lt;h2 id="fields"&gt;Fields&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;space_id: ObjectId&lt;/code&gt; — loose reference (by ID string) to the &lt;code&gt;GeometricSpace&lt;/code&gt; that defines the coordinate frame; keeps &lt;code&gt;SpatialExtent&lt;/code&gt; lightweight with no hard dependency on the space collection&lt;/li&gt;
&lt;li&gt;&lt;code&gt;geometry: G&lt;/code&gt; — the object&amp;rsquo;s footprint or position&lt;/li&gt;
&lt;li&gt;&lt;code&gt;coordinate_system: CoordinateSystem = CARTESIAN_2D&lt;/code&gt; — coordinate frame of &lt;code&gt;geometry&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;metadata: JsonMap = {}&lt;/code&gt; — arbitrary key/value annotations&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Frozen — mutations create a new &lt;code&gt;SpatialExtent&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>SpatialIndex Protocol</title><link>https://kakchouch.github.io/ometeotl/documentation/class-reference/foundations/spatial/spatial-index/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kakchouch.github.io/ometeotl/documentation/class-reference/foundations/spatial/spatial-index/</guid><description>&lt;p&gt;Source:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/kakchouch/ometeotl/blob/main/src/ometeotl_foundations/spatial/spatial_index.py"&gt;src/ometeotl_foundations/spatial/spatial_index.py&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Local role:
&lt;code&gt;runtime_checkable&lt;/code&gt; Protocol for spatially indexed object lookup. Defines the contract that adapter-backed index implementations (e.g. rtree) must satisfy.&lt;/p&gt;
&lt;p&gt;Big-picture role:
The foundations layer does not ship a concrete &lt;code&gt;SpatialIndex&lt;/code&gt; implementation. &lt;code&gt;SpatialMap&lt;/code&gt; uses a linear O(n) scan that is correct for all inputs. Adapter subclasses of &lt;code&gt;SpatialMap&lt;/code&gt; override &lt;code&gt;ids_containing_point&lt;/code&gt; and &lt;code&gt;ids_intersecting&lt;/code&gt; with a &lt;code&gt;SpatialIndex&lt;/code&gt;-backed implementation.&lt;/p&gt;
&lt;h2 id="protocol-members"&gt;Protocol members&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;insert(object_id: ObjectId, bounds: BoundingBox) -&amp;gt; None&lt;/code&gt; — register &lt;code&gt;object_id&lt;/code&gt; with its axis-aligned bounding box&lt;/li&gt;
&lt;li&gt;&lt;code&gt;remove(object_id: ObjectId) -&amp;gt; None&lt;/code&gt; — remove &lt;code&gt;object_id&lt;/code&gt; from the index; no-op if not present&lt;/li&gt;
&lt;li&gt;&lt;code&gt;query(bounds: BoundingBox) -&amp;gt; List[ObjectId]&lt;/code&gt; — return IDs of all objects whose bounds intersect &lt;code&gt;bounds&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;query_point(point: Coordinate2D) -&amp;gt; List[ObjectId]&lt;/code&gt; — return IDs of all objects whose bounds contain &lt;code&gt;point&lt;/code&gt;; provided as first-class because point-in-box is the most common lookup and adapters can implement it more efficiently than &lt;code&gt;query(BoundingBox.from_point(point))&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="design-notes"&gt;Design notes&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;No &lt;code&gt;update()&lt;/code&gt; method — callers use &lt;code&gt;remove&lt;/code&gt; then &lt;code&gt;insert&lt;/code&gt; to move an entry.&lt;/li&gt;
&lt;li&gt;All operations are keyed by &lt;code&gt;ObjectId&lt;/code&gt; (string alias).&lt;/li&gt;
&lt;li&gt;The index stores bounding boxes only, not full geometry objects.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Example (illustrative — no concrete implementation in foundations):&lt;/p&gt;</description></item><item><title>SpatialMap</title><link>https://kakchouch.github.io/ometeotl/documentation/class-reference/foundations/spatial/spatial-map/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kakchouch.github.io/ometeotl/documentation/class-reference/foundations/spatial/spatial-map/</guid><description>&lt;p&gt;Source:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/kakchouch/ometeotl/blob/main/src/ometeotl_foundations/spatial/spatial_map.py"&gt;src/ometeotl_foundations/spatial/spatial_map.py&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Local role:
Mutable generic container mapping &lt;code&gt;ObjectId → SpatialExtent[G]&lt;/code&gt;. Concrete class — not a Protocol.&lt;/p&gt;
&lt;p&gt;Big-picture role:
Tracks spatial positions for actors, resources, or any other objects within a coordinate frame. The default implementation scans all extents linearly for spatial queries; adapter subclasses override the query methods with a &lt;code&gt;SpatialIndex&lt;/code&gt;-backed implementation for O(log n) performance.&lt;/p&gt;
&lt;h2 id="type-parameter"&gt;Type parameter&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;G&lt;/code&gt; — bound to &lt;code&gt;Geometry&lt;/code&gt;. The concrete geometry type stored in all extents within this map.&lt;/p&gt;</description></item></channel></rss>