MBRContains(g1, g2)
is defined as,
Returns
1
or0
to indicate whether the minimum bounding rectangle of g1 contains the minimum bounding rectangle of g2. This tests the opposite relationship asMBRWithin()
.
MBRWithin(g1, g2)
is defined as,
Returns
1
or0
to indicate whether the minimum bounding rectangle of g1 is within the minimum bounding rectangle of g2. This tests the opposite relationship asMBRContains()
.
What exactly does contains
and within
mean in that context?
Best Answer
These are
DE-91M
(Wikipedia) terms, and they were standardized with Simple Featuresbut, Wikipedia probably covers it best, with two definitions,
The within relationship is the inverse of contains, with one catch "polygons do not contain their boundary." Other than that,
within(a,b) = contains(b,a)
. Though interestingly, linestrings do contain all the points along the linestrings, except the terminal points.For more information see the Wikipedia,