Geometric types in PostgreSQL represent two dimensional spatial objects. These types are not standard SQL data types, and will not be discussed in depth in this book. Table 3-25 gives a brief overview of each of the available geometric types.

Table 3-25. Geometric Types

Type Name

Storage

Description

Example

point

16 bytes

A dimensionless object with no properties except for its location, where x and y is a floating point number.

(x, y)

line

32 bytes

Infinite line. The x and y are the end points of the line segment.

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

lseg

32 bytes

Finite line segment. The x and y are the end points of the line segment

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

box

32 bytes

Rectangular box. The points specified are the opposite corners of the box.

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

path

4+32n bytes

Closed path (similar to polygon), a connected set of points

((x1, y1),... )

path

4+32n bytes

Open path, a connected set of points

[(x1, y1),...]

polygon

4+32n bytes

Polygon (similar to closed path), end points of the line segments that makes up the boundary of the polygon

((x1, y1),...]

circle

24 bytes

The point (x,y) is the center while y is the radius of the circle

<(x, y),r>