MySQL provides several functions that test relations between
        minimal bounding rectangles of two geometries
        g1 and g2. The return
        values 1 and 0 indicate true and false, respectively.
      
            Returns 1 or 0 to indicate whether the Minimum Bounding
            Rectangle of g1 contains the
            Minimum Bounding Rectangle of g2.
            This tests the opposite relationship as
            MBRWithin().
          
mysql>SET @g1 = GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');mysql>SET @g2 = GeomFromText('Point(1 1)');mysql>SELECT MBRContains(@g1,@g2), MBRContains(@g2,@g1);----------------------+----------------------+ | MBRContains(@g1,@g2) | MBRContains(@g2,@g1) | +----------------------+----------------------+ | 1 | 0 | +----------------------+----------------------+
            Returns 1 or 0 to indicate whether the Minimum Bounding
            Rectangles of the two geometries
            g1 and
            g2 are disjoint (do not
            intersect).
          
            Returns 1 or 0 to indicate whether the Minimum Bounding
            Rectangles of the two geometries
            g1 and
            g2 are the same.
          
            Returns 1 or 0 to indicate whether the Minimum Bounding
            Rectangles of the two geometries
            g1 and
            g2 intersect.
          
            Returns 1 or 0 to indicate whether the Minimum Bounding
            Rectangles of the two geometries
            g1 and
            g2 overlap. The term
            spatially overlaps is used if two
            geometries intersect and their intersection results in a
            geometry of the same dimension but not equal to either of
            the given geometries.
          
            Returns 1 or 0 to indicate whether the Minimum Bounding
            Rectangles of the two geometries
            g1 and
            g2 touch. Two geometries
            spatially touch if the interiors of the
            geometries do not intersect, but the boundary of one of the
            geometries intersects either the boundary or the interior of
            the other.
          
            Returns 1 or 0 to indicate whether the Minimum Bounding
            Rectangle of g1 is within the
            Minimum Bounding Rectangle of g2.
            This tests the opposite relationship as
            MBRContains().
          
mysql>SET @g1 = GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');mysql>SET @g2 = GeomFromText('Polygon((0 0,0 5,5 5,5 0,0 0))');mysql>SELECT MBRWithin(@g1,@g2), MBRWithin(@g2,@g1);+--------------------+--------------------+ | MBRWithin(@g1,@g2) | MBRWithin(@g2,@g1) | +--------------------+--------------------+ | 1 | 0 | +--------------------+--------------------+


User Comments
Add your own comment.