Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Learn about geometry properties. This section details SQL functions for retrieving attributes of spatial objects, such as area, length, and bounding box, essential for geospatial analysis.
Synonym for ST_BOUNDARY. Returns a geometry representing the closure of the combinatorial boundary of the geometry value.
A synonym for ST_BOUNDARY.
This page is licensed: CC BY-SA / Gnu FDL
Synonym for ST_DIMENSION. Returns the inherent dimension of a geometry object (0 for Point, 1 for LineString, 2 for Polygon).
A synonym for .
This page is licensed: CC BY-SA / Gnu FDL
Returns the Minimum Bounding Rectangle (MBR) for the geometry value. The result is returned as a Polygon defined by the corner points.
ST_ENVELOPE(g)
ENVELOPE(g)Returns the Minimum Bounding Rectangle (MBR) for the geometry value g. The result is returned as a Polygon value.
The polygon is defined by the corner points of the bounding box:
ST_ENVELOPE() and ENVELOPE() are synonyms.
This page is licensed: GPLv2, originally from
POLYGON((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))SELECT AsText(ST_ENVELOPE(GeomFromText('LineString(1 1,4 4)')));
+----------------------------------------------------------+
| AsText(ST_ENVELOPE(GeomFromText('LineString(1 1,4 4)'))) |
+----------------------------------------------------------+
| POLYGON((1 1,4 1,4 4,1 4,1 1)) |
+----------------------------------------------------------+Synonym for ST_NUMGEOMETRIES. Returns the number of geometries contained in a GeometryCollection.
A synonym for ST_NumGeometries.
This page is licensed: CC BY-SA / Gnu FDL
Synonym for ST_ISSIMPLE. Checks if a geometry is simple, meaning it has no anomalous geometric points like self-intersections.
A synonym for ST_IsSImple.
This page is licensed: CC BY-SA / Gnu FDL
ST_GeometryType() and GeometryType() are synonyms.
This page is licensed: GPLv2, originally from fill_help_tables.sql
ST_GeometryType(g)
GeometryType(g)SELECT GeometryType(GeomFromText('POINT(1 1)'));
+------------------------------------------+
| GeometryType(GeomFromText('POINT(1 1)')) |
+------------------------------------------+
| POINT |
+------------------------------------------+Returns the combinatorial boundary of a geometry. For a Polygon, this is the line string defining the boundary.
Synonym for ST_ISRING. Checks if a LineString is a ring, meaning it is both closed and simple.
A synonym for ST_IsRing.
This page is licensed: CC BY-SA / Gnu FDL
Checks if the geometry is simple (no self-intersections or anomalous points). Returns 1 if simple, 0 otherwise.
Synonym for ST_ENVELOPE. Returns the Minimum Bounding Rectangle (MBR) for the given geometry as a Polygon.
A synonym for .
This page is licensed: CC BY-SA / Gnu FDL
Synonym for ST_GEOMETRYN. Returns the N-th geometry from a GeometryCollection, numbered starting from 1.
A synonym for ST_GeometryN.
This page is licensed: CC BY-SA / Gnu FDL
SELECT ST_AsText(ST_Boundary(ST_GeomFromText('LINESTRING(3 3,0 0, -3 3)')));
+----------------------------------------------------------------------+
| ST_AsText(ST_Boundary(ST_GeomFromText('LINESTRING(3 3,0 0, -3 3)'))) |
+----------------------------------------------------------------------+
| MULTIPOINT(3 3,-3 3) |
+----------------------------------------------------------------------+
SELECT ST_AsText(ST_Boundary(ST_GeomFromText('POLYGON((3 3,0 0, -3 3, 3 3))')));
+--------------------------------------------------------------------------+
| ST_AsText(ST_Boundary(ST_GeomFromText('POLYGON((3 3,0 0, -3 3, 3 3))'))) |
+--------------------------------------------------------------------------+
| LINESTRING(3 3,0 0,-3 3,3 3) |
+--------------------------------------------------------------------------+SET @g = 'Point(1 2)';
SELECT ST_ISSIMPLE(GEOMFROMTEXT(@g));
+-------------------------------+
| ST_ISSIMPLE(GEOMFROMTEXT(@g)) |
+-------------------------------+
| 1 |
+-------------------------------+St_IsRing() and IsRing() are synonyms.
This page is licensed: CC BY-SA / Gnu FDL
ST_IsRing(g)
IsRing(g)ST_IsClosed() and IsClosed() are synonyms.This page is licensed: CC BY-SA / Gnu FDL
ST_IsClosed(g)
IsClosed(g)SET @ls = 'LineString(0 0, 0 4, 4 4, 0 0)';
SELECT ST_ISCLOSED(GEOMFROMTEXT(@ls));
+--------------------------------+
| ST_ISCLOSED(GEOMFROMTEXT(@ls)) |
+--------------------------------+
| 1 |
+--------------------------------+
SET @ls = 'LineString(0 0, 0 4, 4 4, 0 1)';
SELECT ST_ISCLOSED(GEOMFROMTEXT(@ls));
+--------------------------------+
| ST_ISCLOSED(GEOMFROMTEXT(@ls)) |
+--------------------------------+
| 0 |
+--------------------------------+Returns the N-th geometry in a GeometryCollection. Geometries are numbered beginning with 1.
Returns the inherent dimension of the geometry value. Returns 0 for points, 1 for linear geometries, and 2 for surface geometries.
Returns the number of geometries in a GeometryCollection. Returns NULL if the argument is not a GeometryCollection.
Returns the Spatial Reference Identifier (SRID) for the geometry. This integer represents the coordinate system used.
ST_SRID(g)
SRID(g)Returns an integer indicating the Spatial Reference System ID for the geometry value g.
In MariaDB, the SRID value is just an integer associated with the geometry value. All calculations are done assuming Euclidean (planar) geometry.
ST_SRID() and SRID() are synonyms.
This page is licensed: GPLv2, originally from
Synonym for ST_SRID. Returns the Spatial Reference Identifier (SRID) integer associated with the geometry.
A synonym for .
This page is licensed: CC BY-SA / Gnu FDL
Synonym for ST_ISCLOSED. Checks if a LineString's start and end points are the same (closed).
A synonym for ST_IsClosed.
This page is licensed: CC BY-SA / Gnu FDL
Synonym for ST_GEOMETRYTYPE. Returns the name of the geometry type (e.g., 'POINT') of the geometry instance.
A synonym for ST_GeometryType.
This page is licensed: CC BY-SA / Gnu FDL
SET @gc = 'GeometryCollection(Point(1 1),LineString(12 14, 9 11))';
SELECT AsText(GeometryN(GeomFromText(@gc),1));
+----------------------------------------+
| AsText(GeometryN(GeomFromText(@gc),1)) |
+----------------------------------------+
| POINT(1 1) |
+----------------------------------------+-1
empty geometry
0
geometry with no length or area
1
geometry with no area but nonzero length
2
geometry with nonzero area
SET @gc = 'GeometryCollection(Point(1 1),LineString(2 2, 3 3))';
SELECT NUMGEOMETRIES(GeomFromText(@gc));
+----------------------------------+
| NUMGEOMETRIES(GeomFromText(@gc)) |
+----------------------------------+
| 2 |
+----------------------------------+SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
+-----------------------------------------------+
| SRID(GeomFromText('LineString(1 1,2 2)',101)) |
+-----------------------------------------------+
| 101 |
+-----------------------------------------------+SELECT Dimension(GeomFromText('LineString(1 1,2 2)'));
+------------------------------------------------+
| Dimension(GeomFromText('LineString(1 1,2 2)')) |
+------------------------------------------------+
| 1 |
+------------------------------------------------+Checks if a geometry is empty. Returns 1 if the geometry contains no points, and 0 otherwise.
ST_IsEmpty(g)
IsEmpty(g)IsEmpty is a function defined by the OpenGIS specification, but is not fully implemented by MariaDB or MySQL.
Since MariaDB and MySQL do not support GIS EMPTY values such as POINT EMPTY, as implemented it simply returns 1 if the geometry value g is invalid, 0 if it is valid, and NULL if the argument is NULL.
ST_IsEmpty() and IsEmpty() are synonyms.
This page is licensed: GPLv2, originally from
Synonym for ST_ISEMPTY. Checks if a geometry is empty (contains no point sets). Returns 1 if empty, 0 otherwise.
A synonym for ST_IsEmpty.
This page is licensed: CC BY-SA / Gnu FDL
Tests if two geometries are spatially related according to a given DE-9IM intersection matrix pattern.