ST_CoveredBy()

Returns 1 when no point of the first geometry lies outside the second geometry.

Syntax

ST_CoveredBy(geom1, geom2)

Aliases: none.

Arguments

geom1 and geom2 are GEOMETRY values.

Return Value

Returns BOOL.

Usage Notes

  • ST_CoveredBy(a, b) is the inverse positional relationship of ST_Covers(b, a); boundary points are covered.

  • Both geometries must have the same SRID. Predicates are Cartesian (SRID 0), not geodetic SRID 4326 predicates.

Examples

DROP DATABASE IF EXISTS geo_covered_by_demo;
CREATE DATABASE geo_covered_by_demo;
USE geo_covered_by_demo;

SELECT ST_CoveredBy(ST_GeomFromText('POINT(0 2)'), ST_GeomFromText('POLYGON((0 0, 4 0, 4 4, 0 4, 0 0))')) AS covered_by_polygon;

DROP DATABASE geo_covered_by_demo;

See Also

ST_Covers(), ST_Within().