Geometric data types represent two-dimensional spatial
objects. Table 5-17 shows the geometric
types available in PostgreSQL. The
most fundamental type, the point, forms the basis for all of the
other types.

Table 5-17. Geometric Types

Geometric Type

Storage

Representation

Description

point

16 bytes

(x,y)

Point in space

line

32 bytes

((x1,y1),(x2,y2))

Infinite line (not fully implemented)

lseg

32 bytes

((x1,y1),(x2,y2))

Finite line segment

box

32 bytes

((x1,y1),(x2,y2))

Rectangular box

path

16+16n bytes

((x1,y1),...)

Closed path (similar to polygon)

path

16+16n bytes

[(x1,y1),...]

Open path

polygon

40+16n bytes

((x1,y1),...)

Polygon (similar to closed path)

circle

24 bytes

<(x,y),r>

Circle (center and radius)

A rich set of functions and operators is available to perform various geometric
operations such as scaling, translation, rotation, and determining
intersections. They are explained in Section 6.9.

Boxes are output using the first syntax.
The corners are reordered on input to store
the upper right corner, then the lower left corner.
Other corners of the box can be entered, but the lower
left and upper right corners are determined from the input and stored corners.

Paths are represented by connected sets of points. Paths can be
open, where
the first and last points in the set are not connected, and closed,
where the first and last point are connected. Functions
popen(p)
and
pclose(p)
are supplied to force a path to be open or closed, and functions
isopen(p)
and
isclosed(p)
are supplied to test for either type in a query.

End points of the line segments comprising the path.
A leading square bracket ([) indicates an open path, while
a leading parenthesis (() indicates a closed path.

Polygons are represented by sets of points. Polygons should probably be
considered equivalent to closed paths, but are stored differently
and have their own set of support routines.