Geen cache-versie.

Caching uitgeschakeld. Standaardinstelling voor deze pagina:ingeschakeld (code DEF204)
Als het scherm te langzaam is, kunt u de gebruikersmodus uitschakelen om de cacheversie te bekijken.

Rechercher dans le manuel MySQL

12.16.7.4 Polygon and MultiPolygon Property Functions

Functions in this section return properties of Polygon or MultiPolygon values.

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

  • If any argument is NULL or any geometry argument is 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 has an SRID value that 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.

  • Otherwise, the return value is non-NULL.

These functions are available for obtaining polygon properties:

  • ST_Area({poly|mpoly})

    Returns a double-precision number indicating the area of the Polygon or MultiPolygon argument, as measured in its spatial reference system.

    As of MySQL 8.0.13, ST_Area() handles its arguments as described in the introduction to this section, with these exceptions:

    • If the geometry is geometrically invalid, either the result is an undefined area (that is, it can be any number), or an error occurs.

    • If the geometry is valid but is not a Polygon or MultiPolygon object, an ER_UNEXPECTED_GEOMETRY_TYPE error occurs.

    • If the geometry is a valid Polygon in a Cartesian SRS, the result is the Cartesian area of the polygon.

    • If the geometry is a valid MultiPolygon in a Cartesian SRS, the result is the sum of the Cartesian area of the polygons.

    • If the geometry is a valid Polygon in a geographic SRS, the result is the geodetic area of the polygon in that SRS, in square meters.

    • If the geometry is a valid MultiPolygon in a geographic SRS, the result is the sum of geodetic area of the polygons in that SRS, in square meters.

    • If an area computation results in +inf, an ER_DATA_OUT_OF_RANGE error occurs.

    • If the geometry has a geographic SRS with a longitude or latitude that is out of range, an error occurs:

      Ranges shown are in degrees. The exact range limits deviate slightly due to floating-point arithmetic.

    Prior to MySQL 8.0.13, ST_Area() handles its arguments as described in the introduction to this section, with these exceptions:

    • For arguments of dimension 0 or 1, the result is 0.

    • If a geometry is empty, the return value is 0 rather than NULL.

    • For a geometry collection, the result is the sum of the area values of all components. If the geometry collection is empty, its area is returned as 0.

    • If the geometry has an SRID value for a geographic spatial reference system (SRS), an ER_NOT_IMPLEMENTED_FOR_GEOGRAPHIC_SRS error occurs.

    1. mysql> SET @poly =
    2.        'Polygon((0 0,0 3,3 0,0 0),(1 1,1 2,2 1,1 1))';
    3. mysql> SELECT ST_Area(ST_GeomFromText(@poly));
    4. +---------------------------------+
    5. | ST_Area(ST_GeomFromText(@poly)) |
    6. +---------------------------------+
    7. |                               4 |
    8. +---------------------------------+
    9.  
    10. mysql> SET @mpoly =
    11.        'MultiPolygon(((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1)))';
    12. mysql> SELECT ST_Area(ST_GeomFromText(@mpoly));
    13. +----------------------------------+
    14. | ST_Area(ST_GeomFromText(@mpoly)) |
    15. +----------------------------------+
    16. |                                8 |
    17. +----------------------------------+
  • ST_Centroid({poly|mpoly})

    Returns the mathematical centroid for the Polygon or MultiPolygon argument as a Point. The result is not guaranteed to be on the MultiPolygon.

    This function processes geometry collections by computing the centroid point for components of highest dimension in the collection. Such components are extracted and made into a single MultiPolygon, MultiLineString, or MultiPoint for centroid computation.

    ST_Centroid() handles its arguments as described in the introduction to this section, with these exceptions:

    • The return value is NULL for the additional condition that the argument is an empty geometry collection.

    • If the geometry has an SRID value for a geographic spatial reference system (SRS), an ER_NOT_IMPLEMENTED_FOR_GEOGRAPHIC_SRS error occurs.

    1. mysql> SET @poly =
    2.        ST_GeomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7,5 5))');
    3. mysql> SELECT ST_GeometryType(@poly),ST_AsText(ST_Centroid(@poly));
    4. +------------------------+--------------------------------------------+
    5. | ST_GeometryType(@poly) | ST_AsText(ST_Centroid(@poly))              |
    6. +------------------------+--------------------------------------------+
    7. | POLYGON                | POINT(4.958333333333333 4.958333333333333) |
    8. +------------------------+--------------------------------------------+
  • ST_ExteriorRing(poly)

    Returns the exterior ring of the Polygon value poly as a LineString.

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

    1. mysql> SET @poly =
    2.        'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))';
    3. mysql> SELECT ST_AsText(ST_ExteriorRing(ST_GeomFromText(@poly)));
    4. +----------------------------------------------------+
    5. | ST_AsText(ST_ExteriorRing(ST_GeomFromText(@poly))) |
    6. +----------------------------------------------------+
    7. | LINESTRING(0 0,0 3,3 3,3 0,0 0)                    |
    8. +----------------------------------------------------+
  • ST_InteriorRingN(poly, N)

    Returns the N-th interior ring for the Polygon value poly as a LineString. Rings are numbered beginning with 1.

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

    1. mysql> SET @poly =
    2.        'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))';
    3. mysql> SELECT ST_AsText(ST_InteriorRingN(ST_GeomFromText(@poly),1));
    4. +-------------------------------------------------------+
    5. | ST_AsText(ST_InteriorRingN(ST_GeomFromText(@poly),1)) |
    6. +-------------------------------------------------------+
    7. | LINESTRING(1 1,1 2,2 2,2 1,1 1)                       |
    8. +-------------------------------------------------------+
  • ST_NumInteriorRing(poly), ST_NumInteriorRings(poly)

    Returns the number of interior rings in the Polygon value poly.

    ST_NumInteriorRing() and ST_NuminteriorRings() handle their arguments as described in the introduction to this section.

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

Zoek in de MySQL-handleiding

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 26/06/2006 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/mysql-rf-gis-polygon-property-functions.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:en Manuel MySQL : https://dev.mysql.com/

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.

Inhoudsopgave Haut