Tous les produits
Search
Centre de documentation

AnalyticDB:Fonctions d'accès

Dernière mise à jour :Aug 10, 2026

Les fonctions d'accès extraient des valeurs BIGINT, DOUBLE ou GEOMETRY à partir d'objets géométriques. Utilisez-les pour interroger les coordonnées, les dimensions, les longueurs, la validité et les propriétés structurelles des données spatiales.

Aperçu des fonctions

Fonction Valeur de retour Description
ST_XMax DOUBLE Coordonnée X maximale d'une géométrie
ST_YMax DOUBLE Coordonnée Y maximale d'une géométrie
ST_XMin DOUBLE Coordonnée X minimale d'une géométrie
ST_YMin DOUBLE Coordonnée Y minimale d'une géométrie
ST_Distance DOUBLE Distance linéaire entre deux géométries
ST_Distance_Sphere DOUBLE Distance sphérique entre deux géométries
ST_Area DOUBLE Aire euclidienne d'une géométrie dans l'espace 2D
ST_Centroid GEOMETRY Centre géométrique d'une géométrie
ST_ConvexHull GEOMETRY Plus petite géométrie convexe englobant toutes les géométries d'entrée
ST_CoordDim TINYINT Dimension des composantes de coordonnées
ST_Dimension TINYINT Dimension inhérente d'une géométrie
ST_IsClosed INT Indique si une linestring ou multilinestring est fermée
ST_IsEmpty INT Indique si une géométrie est vide
ST_IsValid INT Indique si une géométrie est valide
Geometry_invalid_reason VARCHAR Raison pour laquelle une géométrie n'est pas valide
ST_Length DOUBLE Longueur d'une linestring, ou distance orthodromique pour une geography
Line_locate_point DOUBLE Position du point le plus proche sur une linestring par rapport à un point donné, exprimée sous forme de fraction de la longueur de la ligne
Line_interpolate_point GEOMETRY Point situé à une distance fractionnaire le long d'une ligne
Line_interpolate_points GEOMETRY Tous les points situés à une distance fractionnaire le long d'une ligne
ST_NumInteriorRing BIGINT Nombre d'anneaux intérieurs dans un polygone
ST_InteriorRings Array[GEOMETRY] Tous les anneaux intérieurs dans un polygone
ST_NumGeometries INT Nombre de géométries dans une collection
ST_GeometryN GEOMETRY Élément géométrique à un index donné
ST_PointN GEOMETRY Sommet d'une linestring à un index donné
ST_Geometries GEOMETRY Tableau de géométries dans une collection
ST_InteriorRingN GEOMETRY Anneau intérieur à un index donné
ST_NumPoints BIGINT Nombre de points dans une géométrie
ST_IsRing INT Indique si une linestring est fermée et simple
ST_StartPoint GEOMETRY Premier point d'une géométrie linéaire
Simplify_geometry GEOMETRY Version simplifiée d'une géométrie utilisant l'algorithme Ramer-Douglas-Peucker
ST_EndPoint GEOMETRY Dernier point d'une géométrie linéaire
ST_Points GEOMETRY Tableau de points issus d'une linestring
ST_X DOUBLE Coordonnée X d'un point
ST_Y DOUBLE Coordonnée Y d'un point
ST_GeometryType VARCHAR Type d'une géométrie
Les fonctions qui renvoient GEOMETRY produisent une sortie binaire lorsqu'elles sont interrogées directement avec SELECT . Enveloppez le résultat dans ST_AsText() pour obtenir un texte lisible. Pour les fonctions qui renvoient des tableaux de géométries, utilisez la fonction transform avec une expression Lambda afin de convertir chaque élément.

ST_XMax

ST_XMax(g1)

Renvoie la coordonnée X maximale de g1.

Type de retour : DOUBLE

Exemple :

SELECT ST_XMax(ST_GeomFromText('POINT (1.5 2.5)'));
+----------------------------------------------+
| ST_XMax(ST_GeomFromText('POINT (1.5 2.5)'))  |
+----------------------------------------------+
|                         1.5                  |

Fonctions associées : ST_XMin, ST_YMax, ST_YMin

ST_YMax

ST_YMax(g1)

Renvoie la coordonnée Y maximale de g1.

Type de retour : DOUBLE

Exemple :

SELECT ST_YMax(ST_GeomFromText('POINT (1.5 2.5)'));
+----------------------------------------------+
| ST_YMax(ST_GeomFromText('POINT (1.5 2.5)'))  |
+----------------------------------------------+
|                         2.5                  |

Fonctions associées : ST_YMin, ST_XMax, ST_XMin

ST_XMin

ST_XMin(g1)

Renvoie la coordonnée X minimale de g1.

Type de retour : DOUBLE

Exemple :

SELECT ST_XMin(ST_GeomFromText('MULTIPOINT (1 2, 2 4, 3 6, 4 8)'));
+-------------------------------------------------------------+
| ST_XMin(ST_GeomFromText('MULTIPOINT (1 2, 2 4, 3 6, 4 8)')) |
+-------------------------------------------------------------+
|                         1.0                                 |

Fonctions associées : ST_XMax, ST_YMin, ST_YMax

ST_YMin

ST_YMin(g1)

Renvoie la coordonnée Y minimale de g1.

Type de retour : DOUBLE

Exemple :

SELECT ST_YMin(ST_GeomFromText('MULTIPOINT (1 2, 2 4, 3 6, 4 8)'));
+-------------------------------------------------------------+
| ST_YMin(ST_GeomFromText('MULTIPOINT (1 2, 2 4, 3 6, 4 8)')) |
+-------------------------------------------------------------+
|                        2.0                                  |

Fonctions associées : ST_YMax, ST_XMin, ST_XMax

ST_Distance

ST_Distance(g1, g2)

Renvoie la distance linéaire entre g1 et g2.

Type de retour : DOUBLE

Exemple :

SELECT ST_Distance(ST_Point(1,1), ST_Point(2,2));
+-------------------------------------------+
| ST_Distance(ST_Point(1,1), ST_Point(2,2)) |
+-------------------------------------------+
|                        1.4142135623730951 |

Fonctions associées : ST_Distance_Sphere, ST_Length

ST_Distance_Sphere

ST_Distance_Sphere(g1, g2 [, radius])

Renvoie la distance sphérique entre g1 et g2. Le paramètre optionnel radius définit le rayon de la sphère en mètres. Le rayon par défaut est de 6 370 986 mètres.

Type de retour : DOUBLE

Exemple :

SELECT ST_Distance_Sphere(point(1,1), point(2,2));
+--------------------------------------------+
| ST_Distance_Sphere(point(1,1), point(2,2)) |
+--------------------------------------------+
|                         157225.08654191086 |

Fonctions associées : ST_Distance, ST_Length

ST_Area

ST_Area(g1)

Renvoie l'aire euclidienne de g1 dans l'espace 2D.

Type de retour : DOUBLE

Exemple :

SELECT ST_Area(ST_GeometryFromText('POLYGON ((2 2, 2 6, 6 6, 6 2))'));
+------------------------------------------------------------------------+
| ST_Area(ST_GeometryFromText('POLYGON ((2 2, 2 6, 6 6, 6 2))'))         |
+------------------------------------------------------------------------+
|                        16.0                                            |

ST_Centroid

ST_Centroid(g1)

Renvoie le centre géométrique de g1.

Type de retour : GEOMETRY. Utilisez ST_AsText() pour convertir le résultat en texte lisible.

Exemple :

SELECT ST_AsText(ST_Centroid(ST_GeometryFromText('POINT (3 5)')));
+-------------------------------------------------------------------+
| ST_AsText(ST_Centroid(ST_GeometryFromText('POINT (3 5)')))        |
+-------------------------------------------------------------------+
|                       POINT (3 5)                                 |

ST_ConvexHull

ST_ConvexHull(g1)

Renvoie l'enveloppe convexe de g1. L'enveloppe convexe correspond à la plus petite géométrie convexe englobant toutes les géométries contenues dans g1.

Type de retour : GEOMETRY. Utilisez ST_AsText() pour convertir le résultat en texte lisible.

Exemple :

SELECT ST_AsText(ST_ConvexHull(ST_GeometryFromText('LINESTRING (20 20, 30 30)')));
+--------------------------------------------------------------------------------+
| ST_AsText(ST_ConvexHull(ST_GeometryFromText('LINESTRING (20 20, 30 30)')))     |
+--------------------------------------------------------------------------------+
|               POLYGON ((1 1, 5 1, 6 6, 1 1))                                   |

ST_CoordDim

ST_CoordDim(g1)

Renvoie la dimension des composantes de coordonnées de g1.

Type de retour : TINYINT

Exemple :

SELECT ST_CoordDim(ST_GeometryFromText('POLYGON ((1 1, 1 4, 4 4, 4 1))'));
+--------------------------------------------------------------------------------+
| ST_CoordDim(ST_GeometryFromText('POLYGON ((1 1, 1 4, 4 4, 4 1))'))             |
+--------------------------------------------------------------------------------+
|             2                                                                  |

Fonctions associées : ST_Dimension

ST_Dimension

ST_Dimension(g1)

Renvoie la dimension inhérente de g1. La dimension inhérente doit être inférieure ou égale à la dimension des coordonnées.

Type de retour : TINYINT

Exemple :

SELECT ST_Dimension(ST_GeometryFromText('POLYGON ((1 1, 1 4, 4 4, 4 1))'));
+--------------------------------------------------------------------------------+
| ST_Dimension(ST_GeometryFromText('POLYGON ((1 1, 1 4, 4 4, 4 1))'))            |
+--------------------------------------------------------------------------------+
|             2                                                                  |

Fonctions associées : ST_CoordDim

ST_IsClosed

ST_IsClosed(g1)

Indique si les points de début et de fin d'une linestring ou d'une multilinestring coïncident. Renvoie 1 (vrai) si la géométrie est fermée, sinon 0 (faux).

Type de retour : INT

Exemple :

SELECT ST_IsClosed(ST_GeometryFromText('LINESTRING (1 1, 2 2, 1 3, 1 1)'));
+-------------------------------------------------------------------------------+
| ST_IsClosed(ST_GeometryFromText('LINESTRING (1 1, 2 2, 1 3, 1 1)'))           |
+-------------------------------------------------------------------------------+
|               1                                                               |

Fonctions associées : ST_IsRing, ST_IsValid

ST_IsEmpty

ST_IsEmpty(g1)

Indique si g1 est une collection de géométries, un polygone ou un point vide.

Type de retour : INT

Remarques d'utilisation :

  • Renvoie 0 lorsque la géométrie est vide (0 = vrai).

  • Renvoie 1 lorsque la géométrie n'est pas vide (1 = faux).

Ce comportement est l'inverse des conventions booléennes habituelles. Une valeur de retour de 0 signifie que la géométrie est vide.

Exemple :

SELECT ST_IsEmpty(ST_GeometryFromText('POINT (1.5 2.5)'));
+-------------------------------------------------------------+
| ST_IsEmpty(ST_GeometryFromText('POINT (1.5 2.5)'))          |
+-------------------------------------------------------------+
|              0                                              |

Le résultat est 0 car POINT (1.5 2.5) n'est pas une géométrie vide.

Fonctions associées : ST_IsValid, ST_IsClosed

ST_IsValid

ST_IsValid(g1)

Indique si g1 est une géométrie valide. Renvoie 1 (vrai) si la géométrie est valide.

Type de retour : INT

Exemple :

SELECT ST_IsValid(ST_GeometryFromText('LINESTRING (1 1, 2 2, 1 3, 1 1)'));
+------------------------------------------------------------------------+
| ST_IsValid(ST_GeometryFromText('LINESTRING (1 1, 2 2, 1 3, 1 1)'))     |
+------------------------------------------------------------------------+
|                      1                                                 |

Fonctions associées : Geometry_invalid_reason, ST_IsClosed

Geometry_invalid_reason

Geometry_invalid_reason(g1)

Renvoie la raison pour laquelle g1 n'est pas valide. Utilisez cette fonction conjointement avec ST_IsValid pour diagnostiquer les géométries invalides.

Type de retour : VARCHAR

Exemple :

SELECT Geometry_invalid_reason(ST_GeometryFromText('POLYGON ((0 0, 1 1, 0 1, 1 0, 0 0))'));
+----------------------------------------------------------------------------------------+
| Geometry_invalid_reason(ST_GeometryFromText('POLYGON ((0 0, 1 1, 0 1, 1 0, 0 0))'))    |
+----------------------------------------------------------------------------------------+
|     Intersecting or overlapping segments at or near (1.0 0.0) and (1.0 1.0)            |

Fonctions associées : ST_IsValid

ST_Length

ST_Length(g1)

Renvoie la longueur euclidienne pour une linestring ou une multilinestring, ou la distance orthodromique pour une geography.

Type de retour : DOUBLE

Exemple :

SELECT ST_Length(ST_GeometryFromText('LINESTRING (1 1, 1 2)'));
+----------------------------------------------------------+
| ST_Length(ST_GeometryFromText('LINESTRING (1 1, 1 2)'))  |
+----------------------------------------------------------+
|          1.0                                             |

Fonctions associées : ST_Distance, ST_Distance_Sphere

Line_locate_point

Line_locate_point(g1, g2)

Renvoie la position du point le plus proche sur la linestring g1 par rapport au point g2, exprimée sous forme de fraction de la longueur totale de la ligne.

Type de retour : DOUBLE

Exemple :

SELECT Line_locate_point(ST_GeometryFromText('LINESTRING (0 0, 0 1)'), ST_Point(0, 0.2));
+-------------------------------------------------------------------------------------+
| Line_locate_point(ST_GeometryFromText('LINESTRING (0 0, 0 1)'), ST_Point(0, 0.2))   |
+-------------------------------------------------------------------------------------+
|                                         0.2                                         |

Fonctions associées : Line_interpolate_point, Line_interpolate_points

Line_interpolate_point

Line_interpolate_point(g1, d)

Renvoie le point situé à la distance fractionnaire d depuis le début de la linestring g1.

Type de retour : GEOMETRY. Utilisez ST_AsText() pour convertir le résultat en texte lisible.

Exemple :

SELECT ST_AsText(Line_interpolate_point(ST_GeometryFromText('LINESTRING (0 0, 2 2)'), 0.5));
+----------------------------------------------------------------------------------------+
| ST_AsText(Line_interpolate_point(ST_GeometryFromText('LINESTRING (0 0, 2 2)'), 0.5))   |
+----------------------------------------------------------------------------------------+
|                                        POINT (1 1)                                     |

Fonctions associées : Line_interpolate_points, Line_locate_point

Line_interpolate_points

Line_interpolate_points(g1, d)

Renvoie tous les points situés à la distance fractionnaire d depuis le début de la linestring g1. La fonction renvoie un tableau GEOMETRY. Utilisez la fonction transform avec une expression Lambda pour convertir chaque élément en texte.

Type de retour : GEOMETRY

Exemple :

SELECT transform(Line_interpolate_points(ST_GeometryFromText('LINESTRING (0 0, 1 1, 10 10)'), 0.4), x -> ST_AsText(x));
+-----------------------------------------------------------------------------------------------------------------+
| transform(Line_interpolate_points(ST_GeometryFromText('LINESTRING (0 0, 1 1, 10 10)'), 0.4), x -> ST_AsText(x)) |
+-----------------------------------------------------------------------------------------------------------------+
|      ["POINT (4.000000000000001 4.000000000000001)","POINT (8 8)"]                                               |

Fonctions associées : Line_interpolate_point, Line_locate_point

ST_NumInteriorRing

ST_NumInteriorRing(g1)

Renvoie le nombre d'anneaux intérieurs dans le polygone g1.

Type de retour : BIGINT

Exemple :

SELECT ST_NumInteriorRing(ST_GeometryFromText('POLYGON ((0 0, 0 5, 5 5, 5 0, 0 0))'));
+-------------------------------------------------------------------------------------+
| ST_NumInteriorRing(ST_GeometryFromText('POLYGON ((0 0, 0 5, 5 5, 5 0, 0 0))'))      |
+-------------------------------------------------------------------------------------+
|                                      0                                              |

Fonctions associées : ST_InteriorRings, ST_InteriorRingN

ST_InteriorRings

ST_InteriorRings(g1)

Renvoie un tableau de géométries contenant tous les anneaux intérieurs de g1.

Type de retour : Array[GEOMETRY]

Remarques d'utilisation :

  • Renvoie un tableau vide si le polygone ne contient aucun anneau intérieur.

  • Renvoie null si g1 est une géométrie vide.

  • Renvoie une erreur si g1 n'est pas un polygone.

Exemple :

SELECT ST_InteriorRings(ST_GeometryFromText('POLYGON EMPTY'));
+----------------------------------------------------------------------+
| ST_InteriorRings(ST_GeometryFromText('POLYGON EMPTY'))               |
+----------------------------------------------------------------------+
|                                    null                              |

Fonctions associées : ST_NumInteriorRing, ST_InteriorRingN

ST_NumGeometries

ST_NumGeometries(g1)

Renvoie le nombre de géométries dans la collection g1.

Type de retour : INT

Remarques d'utilisation :

  • Renvoie 1 pour les types de géométrie unique (par exemple, POINT, LINESTRING).

  • Renvoie 0 pour les géométries vides.

  • Pour GEOMETRYCOLLECTION, une géométrie vide à l'intérieur de la collection compte toujours comme une géométrie.

Exemple :

SELECT ST_NumGeometries(ST_GeometryFromText('POINT (1 2)'));
+----------------------------------------------------------------------+
| ST_NumGeometries(ST_GeometryFromText('POINT (1 2)'))                 |
+----------------------------------------------------------------------+
|                                    1                                 |

Fonctions associées : ST_GeometryN, ST_Geometries

ST_GeometryN

ST_GeometryN(g, i)

Renvoie l'élément géométrique à l'index i dans la collection g. Les index commencent à 1.

Type de retour : GEOMETRY. Utilisez ST_AsText() pour convertir le résultat en texte lisible.

Remarques d'utilisation :

  • Si g est un objet GEOMETRYCOLLECTION ou MULTI*, renvoie la géométrie à l'index i.

  • Renvoie null si i est inférieur à 1 ou supérieur au nombre total d'éléments.

Exemple :

SELECT ST_ASText(ST_GeometryN(ST_GeometryFromText('POINT (1 2)'), 1));
+---------------------------------------------------------------------------------+
|   ST_ASText(ST_GeometryN(ST_GeometryFromText('POINT (1 2)'), 1))                |
+---------------------------------------------------------------------------------+
|                  POINT (1 2)                                                    |

Fonctions associées : ST_NumGeometries, ST_Geometries, ST_PointN

ST_PointN

ST_PointN(g, i)

Renvoie le sommet à l'index i dans la linestring g. Les index commencent à 1.

Type de retour : GEOMETRY. Utilisez ST_AsText() pour convertir le résultat en texte lisible.

Remarques d'utilisation :

  • Renvoie null si i est inférieur à 1 ou supérieur au nombre total de points dans la linestring.

Exemple :

SELECT ST_ASText(ST_PointN(ST_GeometryFromText('LINESTRING(1 2, 3 4, 5 6, 7 8)'), 3));
+---------------------------------------------------------------------------------------+
|   ST_ASText(ST_PointN(ST_GeometryFromText('LINESTRING(1 2, 3 4, 5 6, 7 8)'), 3))      |
+---------------------------------------------------------------------------------------+
|                  POINT (5 6)                                                          |

Fonctions associées : ST_StartPoint, ST_EndPoint, ST_NumPoints

ST_Geometries

ST_Geometries(g)

Renvoie un tableau contenant toutes les géométries de la collection g. Utilisez la fonction transform avec une expression Lambda pour convertir chaque élément en texte.

Type de retour : GEOMETRY

Remarques d'utilisation :

  • Renvoie un tableau à un élément si g n'est pas une géométrie multiple.

  • Renvoie null si g est vide.

Exemple :

SELECT transform(ST_Geometries(ST_GeometryFromText('POINT (1 5)')), x -> ST_ASText(x));
+---------------------------------------------------------------------------------------+
|   transform(ST_Geometries(ST_GeometryFromText('POINT (1 5)')), x -> ST_ASText(x))     |
+---------------------------------------------------------------------------------------+
|                  POINT (1 5)                                                          |

Fonctions associées : ST_NumGeometries, ST_GeometryN

ST_InteriorRingN

ST_InteriorRingN(g, d)

Renvoie l'anneau intérieur à l'index d dans le polygone g. Les index commencent à 1.

Type de retour : GEOMETRY. Utilisez ST_AsText() pour convertir le résultat en texte lisible.

Remarques d'utilisation :

  • Renvoie null si d est inférieur à 1 ou supérieur au nombre total d'anneaux intérieurs.

  • Renvoie une erreur si g n'est pas un polygone.

Exemple :

SELECT ST_ASText(ST_InteriorRingN(ST_GeometryFromText('POLYGON ((0 0, 0 3, 3 3, 3 0, 0 0), (1 1, 1 2, 2 2, 2 1, 1 1))'), 1));
+-----------------------------------------------------------------------------------------------------------------------------+
|    ST_ASText(ST_InteriorRingN(ST_GeometryFromText('POLYGON ((0 0, 0 3, 3 3, 3 0, 0 0), (1 1, 1 2, 2 2, 2 1, 1 1))'), 1))    |
+-----------------------------------------------------------------------------------------------------------------------------+
|                 LINESTRING (1 1, 1 2, 2 2, 2 1, 1 1)                                                                        |

Fonctions associées : ST_NumInteriorRing, ST_InteriorRings

ST_NumPoints

ST_NumPoints(g)

Renvoie le nombre de points dans la géométrie g.

Type de retour : BIGINT

Exemple :

SELECT ST_NumPoints(ST_GeometryFromText('POINT (1 2)'));
+-------------------------------------------------------------------------+
|     ST_NumPoints(ST_GeometryFromText('POINT (1 2)'))                    |
+-------------------------------------------------------------------------+
|                 1                                                       |

Fonctions associées : ST_PointN, ST_Points

ST_IsRing

ST_IsRing(g)

Renvoie 1 (vrai) si la linestring est à la fois fermée et simple, sinon 0 (faux). Les deux conditions doivent être remplies.

Type de retour : INT

Exemple :

SELECT ST_IsRing(ST_GeometryFromText('LINESTRING (1 1, 1 3, 2 3, 2 1, 1 1)'));
+---------------------------------------------------------------------------------+
|     ST_IsRing(ST_GeometryFromText('LINESTRING (1 1, 1 3, 2 3, 2 1, 1 1)'))      |
+---------------------------------------------------------------------------------+
|                 1                                                               |

Fonctions associées : ST_IsClosed, ST_StartPoint, ST_EndPoint

ST_StartPoint

ST_StartPoint(g)

Renvoie le premier point de la géométrie linéaire g.

Type de retour : GEOMETRY. Utilisez ST_AsText() pour convertir le résultat en texte lisible.

Exemple :

SELECT ST_AsText(ST_StartPoint(ST_GeometryFromText('LINESTRING (8 4, 4 8, 5 6)')));
+-------------------------------------------------------------------------------------+
|     ST_AsText(ST_StartPoint(ST_GeometryFromText('LINESTRING (8 4, 4 8, 5 6)')))     |
+-------------------------------------------------------------------------------------+
|                 POINT (8 4)                                                         |

Fonctions associées : ST_EndPoint, ST_PointN

Simplify_geometry

Simplify_geometry(g, d)

Renvoie une version simplifiée de la géométrie g en utilisant l'algorithme Ramer-Douglas-Peucker. Le paramètre d représente la tolérance de distance. Cette fonction garantit que les géométries dérivées, en particulier les polygones, sont valides.

Type de retour : GEOMETRY. Utilisez ST_AsText() pour convertir le résultat en texte lisible.

Exemple :

SELECT ST_AsText(Simplify_geometry(ST_GeometryFromText('POLYGON ((1 0, 2 1, 3 1, 3 1, 4 1, 1 0))'), 1.5));
+-----------------------------------------------------------------------------------------------------------+
|     ST_AsText(Simplify_geometry(ST_GeometryFromText('POLYGON ((1 0, 2 1, 3 1, 3 1, 4 1, 1 0))'), 1.5))    |
+-----------------------------------------------------------------------------------------------------------+
|                  POLYGON ((1 0, 4 1, 2 1, 1 0))                                                           |

ST_EndPoint

ST_EndPoint(g)

Renvoie le dernier point de la géométrie linéaire g.

Type de retour : GEOMETRY. Utilisez ST_AsText() pour convertir le résultat en texte lisible.

Exemple :

SELECT ST_AsText(ST_EndPoint(ST_GeometryFromText('LINESTRING (8 4, 4 8, 5 6)')));
+-----------------------------------------------------------------------------------+
| ST_AsText(ST_EndPoint(ST_GeometryFromText('LINESTRING (8 4, 4 8, 5 6)')))         |
+-----------------------------------------------------------------------------------+
|                  POINT (5 6)                                                      |

Fonctions associées : ST_StartPoint, ST_PointN

ST_Points

ST_Points(g)

Renvoie un tableau contenant tous les points de la géométrie linestring g. Utilisez la fonction transform avec une expression Lambda pour convertir chaque élément en texte.

Type de retour : GEOMETRY

Exemple :

SELECT transform(ST_Points(ST_GeometryFromText('POINT (0 0)')), x -> ST_AsText(x));
+-----------------------------------------------------------------------------------+
| transform(ST_Points(ST_GeometryFromText('POINT (0 0)')), x -> ST_AsText(x))       |
+-----------------------------------------------------------------------------------+
|                  ["POINT (0 0)"]                                                  |

Fonctions associées : ST_NumPoints, ST_PointN

ST_X

ST_X(g)

Renvoie la coordonnée X du point g.

Type de retour : DOUBLE

Exemple :

SELECT ST_X(ST_GeometryFromText('POINT (1 2)'));
+------------------------------------------------+
|ST_X(ST_GeometryFromText('POINT (1 2)'))        |
+------------------------------------------------+
|                1.0                             |

Fonctions associées : ST_Y, ST_XMax, ST_XMin

ST_Y

ST_Y(g)

Renvoie la coordonnée Y du point g.

Type de retour : DOUBLE

Exemple :

SELECT ST_Y(ST_GeometryFromText('POINT (1 2)'));
+------------------------------------------------+
|ST_Y(ST_GeometryFromText('POINT (1 2)'))        |
+------------------------------------------------+
|                2.0                             |

Fonctions associées : ST_X, ST_YMax, ST_YMin

ST_GeometryType

ST_GeometryType(g1)

Renvoie le type de la géométrie g1 sous forme de chaîne de caractères.

Type de retour : VARCHAR

Exemple :

SELECT ST_GeometryType(ST_Point(1, 4))
+---------------------------------------+
|ST_GeometryType(ST_Point(1, 4))        |
+---------------------------------------+
|                 ST_Point              |