Zones

Define spatial regions with automatic entry/exit detection, proximity alerting, and zone-based data routing. Supports bounding boxes, polygons, and named regions.

Zone Types

Type Fields Use Case
BBoxmin_x, min_y, max_x, max_yRectangular regions, floor plans
Polygonvertices: Vec<[f64; 2]>Irregular boundaries, exclusion zones
Regionname, parent, childrenHierarchical spatial grouping

Detection Events

  • Entry: Entity crosses into zone boundary
  • Exit: Entity leaves zone boundary
  • Inside: Periodic confirmation while entity remains in zone
  • Proximity: Entity within configurable distance of zone edge

Zone-Based Routing

Route data to different processing pipelines based on zone membership. Useful for applying zone-specific visual rules, alerts, or state machines.

YAML Example (HVAC Floor Plan)

YAML
zones:
  - name: building_a
    type: Region
    children: [floor_1, floor_2, floor_3]

  - name: floor_1
    type: BBox
    min_x: 0.0
    min_y: 0.0
    max_x: 50.0
    max_y: 30.0
    on_entry:
      - SendAlert: { severity: Info, message: "Entity entered Floor 1" }
    routing:
      visual_rules: hvac_floor1_rules
      alert_rules: hvac_floor1_alerts

  - name: server_room
    type: Polygon
    vertices:
      - [10.0, 5.0]
      - [20.0, 5.0]
      - [20.0, 15.0]
      - [10.0, 15.0]
    proximity:
      distance: 2.0
      alert: { severity: Warning, message: "Near server room boundary" }
    max_occupancy: 5
    on_entry:
      - LogEvent: { message: "Server room access" }
    on_exit:
      - LogEvent: { message: "Server room departed" }

Spatial Indexing

Zones are indexed with an R-tree for O(log n) point-in-polygon queries. The index rebuilds automatically when zone config changes via hot reload.

Questions?

Reach out for help with integration, deployment, or custom domain codecs.