Skip to content

ST_Contains

Returns true if geomA contains geomB.

Usage

boolean ST_Contains(geomA: geometry, geomB: geometry)

Arguments

  • geomA (geometry): Input geometry
  • geomB (geometry): Input geometry

Description

Returns true if no points of B lie outside A and at least one point of B lies inside A.

Examples

SELECT ST_Contains(
    ST_GeomFromText('POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))'),
    ST_Point(0.25, 0.25)
) AS val;
┌─────────┐
│   val   │
│ boolean │
╞═════════╡
│ true    │
└─────────┘