This section lists the custom PostgreSQL data types installed by PostGIS to represent spatial data.

Each data type describes its type casting behavior. A type cast converts values of one data type into another type. PostgreSQL allows defining casting behavior for custom types, along with the functions used to convert type values. Casts can have automatic behavior, which allows automatic conversion of a function argument to a type supported by the function.

Some casts have explicit behavior, which means the cast must be specified using the syntax `CAST(myval As sometype)` or `myval::sometype`. Explicit casting avoids the issue of ambiguous casts, which can occur when using an overloaded function which does not support a given type. For example, a function may accept a box2d or a box3d, but not a geometry. Since geometry has an automatic cast to both box types, this produces an "ambiguous function" error. To prevent the error use an explicit cast to the desired box type.

All data types can be cast to `text`, so this does not need to be specified explicitly.

# PostGIS Geometry/Geography/Box Data Types

box2d

The type representing a 2-dimensional bounding box.

### Description

`box2d` is a spatial data type used to represent the two-dimensional bounding box enclosing a geometry or collection of geometries. For example, the ST_Extent aggregate function returns a `box2d` object.

The representation contains the values `xmin, ymin, xmax, ymax`. These are the minimum and maximum values of the X and Y extents.

`box2d` objects have a text representation which looks like `BOX(1 2,5 6)`.

### Casting Behavior

This table lists the automatic and explicit casts allowed for this data type:

Cast To | Behavior
box3d | automatic
geometry | automatic

### See Also

PostGIS_BoxFunctions

box3d

The type representing a 3-dimensional bounding box.

### Description

`box3d` is a PostGIS spatial data type used to represent the three-dimensional bounding box enclosing a geometry or collection of geometries. For example, the ST_3DExtent aggregate function returns a `box3d` object.

The representation contains the values `xmin, ymin, zmin, xmax, ymax, zmax`. These are the minimum and maxium values of the X, Y and Z extents.

`box3d` objects have a text representation which looks like `BOX3D(1 2 3,5 6 5)`.

### Casting Behavior

This table lists the automatic and explicit casts allowed for this data type:

Cast To | Behavior
box | automatic
box2d | automatic
geometry | automatic

### See Also

PostGIS_BoxFunctions

geometry

The type representing spatial features with planar coordinate systems.

### Description

`geometry` is a fundamental PostGIS spatial data type used to represent a feature in planar (Euclidean) coordinate systems.

All spatial operations on geometry use the units of the Spatial Reference System the geometry is in.

### Casting Behavior

This table lists the automatic and explicit casts allowed for this data type:

Cast To | Behavior
box | automatic
box2d | automatic
box3d | automatic
bytea | automatic
geography | automatic
text | automatic

### See Also

RefObject, PostGIS_SQLMM_Functions

geometry_dump

A composite type used to describe the parts of complex geometry.

### Description

`geometry_dump` is a composite data type containing the fields:

- `geom` - a geometry representing a component of the dumped geometry. The geometry type depends on the originating function.

- `path[]` - an integer array that defines the navigation path within the dumped geometry to the `geom` component. The path array is 1-based (i.e. `path[1]` is the first element.)

It is used by the `ST_Dump*` family of functions as an output type to explode a complex geometry into its constituent parts.

### See Also

PostGIS_Geometry_DumpFunctions

geography

The type representing spatial features with geodetic (ellipsoidal) coordinate systems.

### Description

`geography` is a spatial data type used to represent a feature in geodetic coordinate systems. Geodetic coordinate systems model the earth using an ellipsoid.

Spatial operations on the geography type provide more accurate results by taking the ellipsoidal model into account.

### Casting Behavior

This table lists the automatic and explicit casts allowed for this data type:

Cast To | Behavior
geometry | explicit

### See Also

PostGIS_Geography, PostGIS_GeographyFunctions