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.