Search the MySQL manual:

11.5.2.5 Polygon Property Analysis Functions

Area(poly)
Returns as a double-precision number the area of the Polygon value poly, as measured in its spatial reference system.
mysql> SELECT Area(GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))'));
+----------------------------------------------------------------------------+
| Area(GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))')) |
+----------------------------------------------------------------------------+
|                                                                          8 |
+----------------------------------------------------------------------------+
NumInteriorRings(poly)
Returns the number of interior rings in the Polygon value poly.
mysql> SELECT NumInteriorRings(GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))'));
+----------------------------------------------------------------------------------------+
| NumInteriorRings(GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))')) |
+----------------------------------------------------------------------------------------+
|                                                                                      1 |
+----------------------------------------------------------------------------------------+
ExteriorRing(poly)
Returns the exterior ring of the Polygon value poly as a LineString.
mysql> SELECT AsText(ExteriorRing(GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))')));
+--------------------------------------------------------------------------------------------+
| AsText(ExteriorRing(GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))'))) |
+--------------------------------------------------------------------------------------------+
| LINESTRING(0 0,0 3,3 3,3 0,0 0)                                                            |
+--------------------------------------------------------------------------------------------+
InteriorRingN(poly,n)
Returns the n-th interior ring for the Polygon value poly as a LineString. Ring numbers begin at 1.
mysql> SELECT AsText(InteriorRingN(GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))'),1));
+-----------------------------------------------------------------------------------------------+
| AsText(InteriorRingN(GeomFromText('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)                                                               |
+-----------------------------------------------------------------------------------------------+

The OpenGIS specification also defines the following functions, which MySQL does not yet implement:

Centroid(poly)
Returns the mathematical centroid for the Polygon value poly as a Point. The result is not guaranteed to be on the polygon.
PointOnSurface(poly)
Returns a Point value that is guaranteed to be on the Polygon value poly.

User Comments

Add your own comment.