AshNeo4j.Type.Box (AshNeo4j v0.7.0)

Copy Markdown View Source

Ash type for an axis-aligned bounding box. v1 supports WGS-84 2D only.

A Box is two %Bolty.Types.Point{} corners — sw (south-west, lower-left) and ne (north-east, upper-right) — matching Neo4j's point.withinBBox signature exactly.

Stored on the node as a 4-Point vertex array [sw, se, ne, nw] (CCW from SW per GeoJSON convention), plus 4 scalar Point companion properties (<prop>.bbSW, <prop>.bbSE, <prop>.bbNE, <prop>.bbNW) written by the data layer for indexed bounding-box queries. The same on-disk shape will be used by AshNeo4j.Type.Polygon when it lands — a Box is a 4-vertex straight-sided polygon that happens to be axis-aligned. No data migration when Polygon ships.

attribute :bounds, AshNeo4j.Type.Box

Place |> Ash.create!(%{
  name: "Sydney bbox",
  bounds: %AshNeo4j.Type.Box{
    sw: Bolty.Types.Point.create(:wgs_84, 151.0, -34.0),
    ne: Bolty.Types.Point.create(:wgs_84, 151.5, -33.5)
  }
})

Antimeridian-crossing boxes (where sw.x > ne.x) are rejected in v1. See ash_neo4j#45.

Summary

Functions

Derives the 4 scalar bbox companion properties (bbSW, bbSE, bbNE, bbNW) from a dumped 4-Point array. Called by the data layer's runtime property assembly to write companion properties alongside the main vertex array. Same shape that Polygon will use — for Box the companions are the polygon vertices themselves.

Types

t()

@type t() :: %AshNeo4j.Type.Box{ne: Bolty.Types.Point.t(), sw: Bolty.Types.Point.t()}

Functions

companions(list)

Derives the 4 scalar bbox companion properties (bbSW, bbSE, bbNE, bbNW) from a dumped 4-Point array. Called by the data layer's runtime property assembly to write companion properties alongside the main vertex array. Same shape that Polygon will use — for Box the companions are the polygon vertices themselves.

handle_change?()

prepare_change?()