MBRWithin

TL;DR

MBRWithin returns whether the first geometry’s minimum bounding rectangle is within the second’s.

Syntax

MBRWithin(geom1, geom2)

Arguments

geom1 and geom2 are GEOMETRY values.

Return Value

Returns BOOL.

Usage Notes

MBRWithin(a, b) reverses the operand order of MBRContains(b, a). It compares bounding rectangles only.

Examples

DROP DATABASE IF EXISTS geo_mbrwithin_demo;
CREATE DATABASE geo_mbrwithin_demo;
USE geo_mbrwithin_demo;

SELECT MBRWithin(ST_GeomFromText('POLYGON((2 2,4 2,4 4,2 4,2 2))'), ST_GeomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0))')) AS within_mbr;

DROP DATABASE geo_mbrwithin_demo;

See Also

MBRContains, MBRCoveredBy, ST_Within