PDF (A4) - 35.2Mb
Man Pages (TGZ) - 256.4Kb
Man Pages (Zip) - 361.2Kb
Info (Gzip) - 3.4Mb
Info (Zip) - 3.4Mb
MySQL Globalization
MySQL Information Schema
MySQL Installation Guide
MySQL and Linux/Unix
MySQL and macOS
MySQL Partitioning
MySQL Performance Schema
MySQL Replication
Using the MySQL Yum Repository
MySQL Restrictions and Limitations
Security in MySQL
MySQL and Solaris
Building MySQL from Source
Starting and Stopping MySQL
MySQL Tutorial
MySQL and Windows
MySQL NDB Cluster 7.5
MySQL provides several MySQL-specific functions that test the relationship between minimum bounding rectangles (MBRs) of two geometriesg1 andg2. The return values 1 and 0 indicate true and false, respectively.
A corresponding set of MBR functions defined according to the OpenGIS specification is described later in this section.
Returns 1 or 0 to indicate whether the minimum bounding rectangle of
g1contains the minimum bounding rectangle ofg2. This tests the opposite relationship asMBRWithin().mysql> SET @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');mysql> SET @g2 = ST_GeomFromText('Point(1 1)');mysql> SELECT MBRContains(@g1,@g2), MBRWithin(@g2,@g1);+----------------------+--------------------+| MBRContains(@g1,@g2) | MBRWithin(@g2,@g1) |+----------------------+--------------------+| 1 | 1 |+----------------------+--------------------+MBRContains()andContains()are synonyms.Returns 1 or 0 to indicate whether the minimum bounding rectangle of
g1is covered by the minimum bounding rectangle ofg2. This tests the opposite relationship asMBRCovers().MBRCoveredBy()handles its arguments as follows:If either argument is
NULLor an empty geometry, the return value isNULL.If either argument is not a syntactically well-formed geometry byte string, an
ER_GIS_INVALID_DATAerror occurs.Otherwise, the return value is non-
NULL.
mysql> SET @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');mysql> SET @g2 = ST_GeomFromText('Point(1 1)');mysql> SELECT MBRCovers(@g1,@g2), MBRCoveredby(@g1,@g2);+--------------------+-----------------------+| MBRCovers(@g1,@g2) | MBRCoveredby(@g1,@g2) |+--------------------+-----------------------+| 1 | 0 |+--------------------+-----------------------+mysql> SELECT MBRCovers(@g2,@g1), MBRCoveredby(@g2,@g1);+--------------------+-----------------------+| MBRCovers(@g2,@g1) | MBRCoveredby(@g2,@g1) |+--------------------+-----------------------+| 0 | 1 |+--------------------+-----------------------+Returns 1 or 0 to indicate whether the minimum bounding rectangle of
g1covers the minimum bounding rectangle ofg2. This tests the opposite relationship asMBRCoveredBy(). See the description ofMBRCoveredBy()for examples.MBRCovers()handles its arguments as follows:If either argument is
NULLor an empty geometry, the return value isNULL.If either argument is not a syntactically well-formed geometry byte string, an
ER_GIS_INVALID_DATAerror occurs.Otherwise, the return value is non-
NULL.
Returns 1 or 0 to indicate whether the minimum bounding rectangles of the two geometries
g1andg2are disjoint (do not intersect).MBRDisjoint()andDisjoint()are synonyms.Returns 1 or 0 to indicate whether the minimum bounding rectangles of the two geometries
g1andg2are the same.MBREqual()is deprecated; expect it to be removed in a future MySQL release. UseMBREquals()instead.Returns 1 or 0 to indicate whether the minimum bounding rectangles of the two geometries
g1andg2are the same.MBREquals(),MBREqual(), andEquals()are synonyms.Returns 1 or 0 to indicate whether the minimum bounding rectangles of the two geometries
g1andg2intersect.MBRIntersects()andIntersects()are synonyms.Two geometriesspatially overlap if they intersect and their intersection results in a geometry of the same dimension but not equal to either of the given geometries.
This function returns 1 or 0 to indicate whether the minimum bounding rectangles of the two geometries
g1andg2overlap.MBROverlaps()andOverlaps()are synonyms.Two geometriesspatially touch if their interiors do not intersect, but the boundary of one of the geometries intersects either the boundary or the interior of the other.
This function returns 1 or 0 to indicate whether the minimum bounding rectangles of the two geometries
g1andg2touch.Returns 1 or 0 to indicate whether the minimum bounding rectangle of
g1is within the minimum bounding rectangle ofg2. This tests the opposite relationship asMBRContains().mysql> SET @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');mysql> SET @g2 = ST_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 |+--------------------+--------------------+MBRWithin()andWithin()are synonyms.
The OpenGIS specification defines the following functions that test the relationship between two geometry valuesg1 andg2. The MySQL implementation uses minimum bounding rectangles, so these functions return the same result as the corresponding MBR-based functions described earlier in this section. The return values 1 and 0 indicate true and false, respectively.
These functions support all argument type combinations except those that are inapplicable according to the Open Geospatial Consortium specification.
MBRContains()andContains()are synonyms. For more information, see the description ofMBRContains().Contains()is deprecated; expect it to be removed in a future MySQL release. UseMBRContains()instead.MBRDisjoint()andDisjoint()are synonyms. For more information, see the description ofMBRDisjoint().Disjoint()is deprecated; expect it to be removed in a future MySQL release. UseMBRDisjoint()instead.MBREquals()andEquals()are synonyms. For more information, see the description ofMBREquals().Equals()is deprecated; expect it to be removed in a future MySQL release. UseMBREquals()instead.MBRIntersects()andIntersects()are synonyms. For more information, see the description ofMBRIntersects().Intersects()is deprecated; expect it to be removed in a future MySQL release. UseMBRIntersects()instead.MBROverlaps()andOverlaps()are synonyms. For more information, see the description ofMBROverlaps().Overlaps()is deprecated; expect it to be removed in a future MySQL release. UseMBROverlaps()instead.MBRWithin()andWithin()are synonyms. For more information, see the description ofMBRWithin().Within()is deprecated; expect it to be removed in a future MySQL release. UseMBRWithin()instead.
PDF (A4) - 35.2Mb
Man Pages (TGZ) - 256.4Kb
Man Pages (Zip) - 361.2Kb
Info (Gzip) - 3.4Mb
Info (Zip) - 3.4Mb
MySQL Globalization
MySQL Information Schema
MySQL Installation Guide
MySQL and Linux/Unix
MySQL and macOS
MySQL Partitioning
MySQL Performance Schema
MySQL Replication
Using the MySQL Yum Repository
MySQL Restrictions and Limitations
Security in MySQL
MySQL and Solaris
Building MySQL from Source
Starting and Stopping MySQL
MySQL Tutorial
MySQL and Windows
MySQL NDB Cluster 7.5