How geometry interiors, exteriors, and boundaries work

The interior of a geometry is all points that are part of the geometry except the boundary.

The exterior of a geometry is all points that are not part of the geometry. This can include the space inside an interior ring, for example in the case of a polygon with a hole. Similarly, the space both inside and outside a linestring ring is considered the exterior.

The boundary of a geometry is what is returned by the ST_Boundary method.

Knowing the boundary of a geometry helps when comparing to another geometry to determine how the two geometries are related. However, while all geometries have an interior and an exterior, not all geometries have a boundary, nor are their boundaries always intuitive.

Here are some cases of geometries where the boundary may not be intuitive:

A diagram showing several geometries. Each geometry is labeled with a letter. A illustrates a point. B illustrates a diagonal line. C illustrates a bent line. D illustrates a vertical line with a perpendicular line that protrudes from its right side. E illustrates a squiggly line. F illustrates two squiggly lines that cross each other. G illustrates an oval with a square inside. The area in the square for G is empty, whereas the area in the circle that is outside of the square is grey. H illustrates a circle.
  • Point   A point (such as A) has no boundary.

  • Lines and curves   The boundary for lines and curves (B, C, D, E, F) are their endpoints. Geometries B, C, and E have two end points for a boundary. Geometry D has four end points for a boundary, and geometry F has four.

  • Polygon   The boundary for a polygon (such as G) is its outer ring and any inner rings.

  • Rings   A ring—a curve where the start point is the same as the end point and there are no self-intersections (such as H)—has no boundary.

 See also