ST_Polygon data type
The ST_Polygon data type is a two-dimensional surface stored as a sequence of points defining its exterior bounding ring and 0 or more interior rings. Most often, ST_Polygon defines parcels of land, water bodies, and other features having spatial extent.
Properties
The ST_Polygon is always simple. The exterior and any interior rings define the boundary of an ST_Polygon, and the space enclosed between the rings defines the interior of ST_Polygon. The rings of an ST_Polygon can intersect at a tangent point, but never cross. In addition to the other properties inherited from the superclass, ST_Geometry, ST_Polygon has area.
The following figure shows
examples of ST_Polygon objects: (1) is an ST_Polygon whose boundary
is defined by an exterior ring; (2) is an ST_Polygon whose boundary
is defined by an exterior ring and two interior rings. The area inside
the interior rings is part of the ST_Polygon's exterior; (3)
is a legal ST_Polygon because the rings intersect at a single tangent
point.
Functions
The following functions operate
on ST_Polygon:
- ST_Area()
- The function returns the polygon's area as a double-precision number.
- ST_ExteriorRing()
- The function returns the polygon's exterior ring as an ST_LineString.
- ST_NumInteriorRing()
- The function returns the number of interior rings that the polygon contains.
- ST_InteriorRingN()
- The function takes an ST_Polygon and an index and returns the nth interior ring as an ST_LineString.
- ST_Centroid()
- The function returns an ST_Point that is the center of the ST_Polygon's envelope.
- ST_PointOnSurface()
- The function returns an ST_Point that is guaranteed to be on the surface of the ST_Polygon.
- ST_Perimeter()
- The function returns the perimeter of an ST_Polygon or ST_MultiPolygon.