Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Learn about POLYGON properties in MariaDB Server. This section details SQL functions for retrieving attributes of polygonal spatial objects, such as area, perimeter, and the number of rings.
Synonym for ST_CENTROID. Returns the mathematical centroid of the Polygon or MultiPolygon as a Point geometry.
A synonym for ST_CENTROID.
This page is licensed: CC BY-SA / Gnu FDL
Synonym for ST_NumInteriorRings. Returns the number of interior rings in a Polygon geometry.
A synonym for ST_NumInteriorRings.
This page is licensed: CC BY-SA / Gnu FDL
Synonym for ST_InteriorRingN. Returns the N-th interior ring of a Polygon as a LineString.
A synonym for .
This page is licensed: CC BY-SA / Gnu FDL
Synonym for ST_AREA. Returns the double-precision area of the Polygon or MultiPolygon, calculated in its spatial reference system.
A synonym for .
This page is licensed: CC BY-SA / Gnu FDL
Synonym for ST_ExteriorRing. Returns the exterior ring of a Polygon as a LineString.
A synonym for .
This page is licensed: CC BY-SA / Gnu FDL
ST_ExteriorRing() and ExteriorRing() are synonyms.
This page is licensed: GPLv2, originally from fill_help_tables.sql
ST_ExteriorRing(poly)
ExteriorRing(poly)SET @poly = 'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))';
SELECT AsText(ExteriorRing(GeomFromText(@poly)));
+-------------------------------------------+
| AsText(ExteriorRing(GeomFromText(@poly))) |
+-------------------------------------------+
| LINESTRING(0 0,0 3,3 3,3 0,0 0) |
+-------------------------------------------+Returns the count of interior rings in a Polygon. This function calculates the total number of inner holes within the polygon.
ST_NumInteriorRings(poly)
NumInteriorRings(poly)Returns an integer containing the number of interior rings in the Polygon value poly.
Note that according the OpenGIS standard, a should have exactly one ExteriorRing and all other rings should lie within that ExteriorRing and thus be the InteriorRings. Practically, however, some systems, including MariaDB's, permit polygons to have several 'ExteriorRings'. In the case of there being multiple, non-overlapping exterior rings ST_NumInteriorRings() will return 1.
ST_NumInteriorRings() and NumInteriorRings() are synonyms.
Non-overlapping 'polygon':
This page is licensed: GPLv2, originally from
SET @poly = 'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))';
SELECT NumInteriorRings(GeomFromText(@poly));
+---------------------------------------+
| NumInteriorRings(GeomFromText(@poly)) |
+---------------------------------------+
| 1 |
+---------------------------------------+Returns the centroid of a Polygon or MultiPolygon. The result is a Point geometry representing the mathematical center of mass.
ST_Centroid(mpoly)
Centroid(mpoly)Returns a point reflecting the mathematical centroid (geometric center) for the MultiPolygon mpoly. The resulting point will not necessarily be on the MultiPolygon.
ST_Centroid() and Centroid() are synonyms.
This page is licensed: CC BY-SA / Gnu FDL
SELECT ST_NumInteriorRings(ST_PolyFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),
(-1 -1,-5 -1,-5 -5,-1 -5,-1 -1))')) AS NumInteriorRings;
+------------------+
| NumInteriorRings |
+------------------+
| 1 |
+------------------+SET @poly = ST_GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))');
SELECT ST_AsText(ST_Centroid(@poly)) AS center;
+--------------+
| center |
+--------------+
| POINT(10 10) |
+--------------+Returns the N-th interior ring of a Polygon. This function retrieves a specific inner hole of the polygon as a LineString.
SET @poly = 'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))';
SELECT AsText(InteriorRingN(GeomFromText(@poly),1));
+----------------------------------------------+
| AsText(InteriorRingN(GeomFromText(@poly),1)) |
+----------------------------------------------+
| LINESTRING(1 1,1 2,2 2,2 1,1 1) |
+----------------------------------------------+Returns the area of a Polygon or MultiPolygon. The result is a double-precision number measured in the geometry's spatial reference units.
SET @poly = 'Polygon((0 0,0 3,3 0,0 0),(1 1,1 2,2 1,1 1))';
SELECT Area(GeomFromText(@poly));
+---------------------------+
| Area(GeomFromText(@poly)) |
+---------------------------+
| 4 |
+---------------------------+