Geometry
Property Analysis Functions
Point
Property Analysis Functions
LineString
Property Analysis Functions
MultiLineString
Property Analysis Functions
Polygon
Property Analysis Functions
MultiPolygon
Property Analysis Functions
GeometryCollection
Property Analysis Functions
Polygon
Property Analysis FunctionsArea(poly)
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)
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)
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)
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)
Polygon
value poly
as a Point
. The result is not guaranteed to be on the polygon.
PointOnSurface(poly)
Point
value that is guaranteed to be on the Polygon
value poly
.