Keine Cache-Version

Caching deaktiviert Standardeinstellung für diese Seite:aktiviert (code DEF204)
Wenn die Anzeige zu langsam ist, können Sie den Benutzermodus deaktivieren, um die zwischengespeicherte Version anzuzeigen.

Rechercher dans le manuel MySQL

12.16.9.2 Spatial Relation Functions That Use Minimum Bounding Rectangles

MySQL provides several MySQL-specific functions that test the relationship between minimum bounding rectangles (MBRs) of two geometries g1 and g2. The return values 1 and 0 indicate true and false, respectively.

The bounding box of a point is interpreted as a point that is both boundary and interior.

The bounding box of a straight horizontal or vertical line is interpreted as a line where the interior of the line is also boundary. The endpoints are boundary points.

If any of the parameters are geometry collections, the interior, boundary, and exterior of those parameters are those of the union of all elements in the collection.

Functions in this section detect arguments in either Cartesian or geographic spatial reference systems (SRSs), and return results appropriate to the SRS.

Unless otherwise specified, functions in this section handle their arguments as follows:

  • If any argument is NULL or an empty geometry, the return value is NULL.

  • If any geometry argument is not a syntactically well-formed geometry, an ER_GIS_INVALID_DATA error occurs.

  • If any geometry argument refers to an undefined spatial reference system (SRS), an ER_SRS_NOT_FOUND error occurs.

  • For functions that take multiple geometry arguments, if those arguments do not have the same SRID, an ER_GIS_DIFFERENT_SRIDS error occurs.

  • If any argument is geometrically invalid, either the result is true or false (it is undefined which), or an error occurs.

  • For geographic SRS geometry arguments, if any argument has a longitude or latitude that is out of range, an error occurs:

    Ranges shown are in degrees. If an SRS uses another unit, the range uses the corresponding values in its unit. The exact range limits deviate slightly due to floating-point arithmetic.

  • Otherwise, the return value is non-NULL.

These MBR functions are available for testing geometry relationships:

  • MBRContains(g1, g2)

    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().

    MBRContains() handles its arguments as described in the introduction to this section.

    1. mysql> SET @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
    2. mysql> SET @g2 = ST_GeomFromText('Point(1 1)');
    3. mysql> SELECT MBRContains(@g1,@g2), MBRWithin(@g2,@g1);
    4. +----------------------+--------------------+
    5. | MBRContains(@g1,@g2) | MBRWithin(@g2,@g1) |
    6. +----------------------+--------------------+
    7. |                    1 |                  1 |
    8. +----------------------+--------------------+
  • MBRCoveredBy(g1, g2)

    Returns 1 or 0 to indicate whether the minimum bounding rectangle of g1 is covered by the minimum bounding rectangle of g2. This tests the opposite relationship as MBRCovers().

    MBRCoveredBy() handles its arguments as described in the introduction to this section.

    1. mysql> SET @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
    2. mysql> SET @g2 = ST_GeomFromText('Point(1 1)');
    3. mysql> SELECT MBRCovers(@g1,@g2), MBRCoveredby(@g1,@g2);
    4. +--------------------+-----------------------+
    5. | MBRCovers(@g1,@g2) | MBRCoveredby(@g1,@g2) |
    6. +--------------------+-----------------------+
    7. |                  1 |                     0 |
    8. +--------------------+-----------------------+
    9. mysql> SELECT MBRCovers(@g2,@g1), MBRCoveredby(@g2,@g1);
    10. +--------------------+-----------------------+
    11. | MBRCovers(@g2,@g1) | MBRCoveredby(@g2,@g1) |
    12. +--------------------+-----------------------+
    13. |                  0 |                     1 |
    14. +--------------------+-----------------------+
  • MBRCovers(g1, g2)

    Returns 1 or 0 to indicate whether the minimum bounding rectangle of g1 covers the minimum bounding rectangle of g2. This tests the opposite relationship as MBRCoveredBy(). See the description of MBRCoveredBy() for examples.

    MBRCovers() handles its arguments as described in the introduction to this section.

  • MBRDisjoint(g1, g2)

    Returns 1 or 0 to indicate whether the minimum bounding rectangles of the two geometries g1 and g2 are disjoint (do not intersect).

    MBRDisjoint() handles its arguments as described in the introduction to this section.

  • MBREquals(g1, g2)

    Returns 1 or 0 to indicate whether the minimum bounding rectangles of the two geometries g1 and g2 are the same.

    MBREquals() handles its arguments as described in the introduction to this section, except that it does not return NULL for empty geometry arguments.

  • MBRIntersects(g1, g2)

    Returns 1 or 0 to indicate whether the minimum bounding rectangles of the two geometries g1 and g2 intersect.

    MBRIntersects() handles its arguments as described in the introduction to this section.

  • MBROverlaps(g1, g2)

    Two geometries spatially 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 g1 and g2 overlap.

    MBROverlaps() handles its arguments as described in the introduction to this section.

  • MBRTouches(g1, g2)

    Two geometries spatially 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 g1 and g2 touch.

    MBRTouches() handles its arguments as described in the introduction to this section.

  • MBRWithin(g1, g2)

    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().

    MBRWithin() handles its arguments as described in the introduction to this section.

    1. mysql> SET @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
    2. mysql> SET @g2 = ST_GeomFromText('Polygon((0 0,0 5,5 5,5 0,0 0))');
    3. mysql> SELECT MBRWithin(@g1,@g2), MBRWithin(@g2,@g1);
    4. +--------------------+--------------------+
    5. | MBRWithin(@g1,@g2) | MBRWithin(@g2,@g1) |
    6. +--------------------+--------------------+
    7. |                  1 |                  0 |
    8. +--------------------+--------------------+

Suchen Sie im MySQL-Handbuch

Deutsche Übersetzung

Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.

Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.

Vielen Dank im Voraus.

Dokument erstellt 26/06/2006, zuletzt geändert 26/10/2018
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/mysql-rf-spatial-relation-functions-mbr.html

Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.

Referenzen

  1. Zeigen Sie - html-Dokument Sprache des Dokuments:en Manuel MySQL : https://dev.mysql.com/

Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.

Inhaltsverzeichnis Haut