In calculating areas (AREA), all holes in a polygon are subtracted out. : AREA « Geometric « SQL / MySQL






In calculating areas (AREA), all holes in a polygon are subtracted out.

    
mysql>
mysql>
mysql> SET @po = POLYFROMTEXT('POLYGON((1 1, 9 1, 9 9, 1 9, 1 1),(3 3, 3 6, 6 6, 6 3, 3 3))');
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql> SELECT AREA(@po), NUMINTERIORRINGS(@po);
+-----------+-----------------------+
| AREA(@po) | NUMINTERIORRINGS(@po) |
+-----------+-----------------------+
|        55 |                     1 |
+-----------+-----------------------+
1 row in set (0.00 sec)

mysql>
mysql> SELECT ASTEXT(INTERIORRINGN(@po, 1));
+---------------------------------+
| ASTEXT(INTERIORRINGN(@po, 1))   |
+---------------------------------+
| LINESTRING(3 3,3 6,6 6,6 3,3 3) |
+---------------------------------+
1 row in set (0.00 sec)

   
    
    
    
  








Related examples in the same category

1.Total area with POLYGON
2.Calculate the area