DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK

# (mysql.info.gz) Polygon property functions

Info Catalog (mysql.info.gz) Multilinestring property functions (mysql.info.gz) Geometry property functions (mysql.info.gz) Multipolygon property functions
```
18.5.2.5 `Polygon' Functions
............................

`Area(POLY)'
Returns as a double-precision number the area of the `Polygon'
value POLY, as measured in its spatial reference system.

mysql> SET @poly = 'Polygon((0 0,0 3,3 0,0 0),(1 1,1 2,2 1,1 1))';
mysql> SELECT Area(GeomFromText(@poly));
+---------------------------+
| Area(GeomFromText(@poly)) |
+---------------------------+
|                         4 |
+---------------------------+

`ExteriorRing(POLY)'
Returns the exterior ring of the `Polygon' value POLY as a
`LineString'.
mysql> SET @poly =
-> 'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))';
mysql> SELECT AsText(ExteriorRing(GeomFromText(@poly)));
+-------------------------------------------+
| AsText(ExteriorRing(GeomFromText(@poly))) |
+-------------------------------------------+
| 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> SET @poly =
-> 'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))';
mysql> SELECT AsText(InteriorRingN(GeomFromText(@poly),1));
+----------------------------------------------+
| AsText(InteriorRingN(GeomFromText(@poly),1)) |
+----------------------------------------------+
| LINESTRING(1 1,1 2,2 2,2 1,1 1)              |
+----------------------------------------------+

`NumInteriorRings(POLY)'
Returns the number of interior rings in the `Polygon' value POLY.
mysql> SET @poly =
-> 'Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))';
mysql> SELECT NumInteriorRings(GeomFromText(@poly));
+---------------------------------------+
| NumInteriorRings(GeomFromText(@poly)) |
+---------------------------------------+
|                                     1 |
+---------------------------------------+

```
Info Catalog (mysql.info.gz) Multilinestring property functions (mysql.info.gz) Geometry property functions (mysql.info.gz) Multipolygon property functions
automatically generated byinfo2html