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_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_NUMGEOMETRIES. Returns the number of geometries contained in a GeometryCollection.
A synonym for ST_NumGeometries.
This page is licensed: CC BY-SA / Gnu FDL
Returns 1 if the LineString is closed (start and end points are the same), 0 if not, and NULL if the argument is NULL.
ST_IsClosed(g)
IsClosed(g)Returns 1 if a given LINESTRING's start and end points are the same, or 0 if they are not the same.
ST_IsClosed() and IsClosed() are synonyms.
This page is licensed: CC BY-SA / Gnu FDL
Synonym for ST_SRID. Returns the Spatial Reference Identifier (SRID) integer associated with the geometry.
A synonym for ST_SRID.
This page is licensed: CC BY-SA / Gnu FDL
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 |
+--------------------------------+Tests if two geometries are spatially related according to a given DE-9IM intersection matrix pattern.
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_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
Synonym for ST_GEOMETRYN. Returns the N-th geometry from a GeometryCollection, numbered starting from 1.
A synonym for .
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
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
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
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
Returns the N-th geometry in a GeometryCollection. Geometries are numbered beginning with 1.
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
Checks if the geometry is simple (no self-intersections or anomalous points). Returns 1 if simple, 0 otherwise.
Checks if the LineString is a ring. Returns 1 if the LineString is both closed (start equals end) and simple (no self-intersection).
ST_IsRing(g)
IsRing(g)Returns true if a given LINESTRING is a ring, that is, both ST_IsClosed and ST_IsSimple. A simple curve does not pass through the same point more than once. However, see .
St_IsRing() and IsRing() are synonyms.
This page is licensed: CC BY-SA / Gnu FDL
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
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) |
+----------------------------------------+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)) |
+----------------------------------------------------------+SET @g = 'Point(1 2)';
SELECT ST_ISSIMPLE(GEOMFROMTEXT(@g));
+-------------------------------+
| ST_ISSIMPLE(GEOMFROMTEXT(@g)) |
+-------------------------------+
| 1 |
+-------------------------------+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 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
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 |
+-----------------------------------------------+Synonym for ST_DIMENSION. Returns the inherent dimension of a geometry object (0 for Point, 1 for LineString, 2 for Polygon).
A synonym for ST_DIMENSION.
This page is licensed: CC BY-SA / Gnu FDL
BOUNDARY() is a synonym.
This page is licensed: GPLv2, originally from fill_help_tables.sql
ST_BOUNDARY(g)
BOUNDARY(g)-1
empty geometry
0
geometry with no length or area
1
geometry with no area but nonzero length
2
geometry with nonzero area
ST_Dimension() and Dimension() are synonyms.
This page is licensed: GPLv2, originally from fill_help_tables.sql
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) |
+--------------------------------------------------------------------------+ST_Dimension(g)
Dimension(g)SELECT Dimension(GeomFromText('LineString(1 1,2 2)'));
+------------------------------------------------+
| Dimension(GeomFromText('LineString(1 1,2 2)')) |
+------------------------------------------------+
| 1 |
+------------------------------------------------+