AshNeo4j.Functions.StContains (AshNeo4j v0.8.0)

Copy Markdown View Source

Spatial containment — true if the first geometry contains the second.

Place
|> Ash.Query.filter(st_contains(bounds, ^test_point))
|> Ash.read!()

Exact, hole-aware containment via topo on the %Geo.*{} geometries (#267). Supports %Geo.Polygon{} and %Geo.MultiPolygon{} as the container, against any of %Geo.Point{}, %Geo.MultiPoint{}, %Geo.LineString{}, %Geo.MultiLineString{}, %Geo.Polygon{}, or %Geo.MultiPolygon{}. OGC contains semantics:

  • st_contains(polygon, multipoint) is true iff every point lies inside the polygon (all-of).
  • st_contains(multipolygon, point) is true iff the point lies in any constituent polygon (any-of).
  • Containment respects interior rings — a point in a hole is not contained.

Inside an Ash.Query.filter, the bbSW/bbNE companions drive a cheap indexed point.withinBBox prefilter in Cypher (over-selects candidates whose bounding box contains the test geometry); the exact topo test then runs in-memory over the prefilter's candidates. A true match always lies within the polygon's bbox, so the prefilter never drops one — it only narrows the set the exact test runs against.

Named after the OGC / PostGIS convention (ST_Contains) for consistency with ash_geo / AshGeo.Postgis so consumer code reads the same across data layers.

Summary

Functions

args()

Callback implementation for Ash.Query.Function.args/0.

has_partial_evaluate?()