> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wherobots.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ST_Box2D

Returns the planar bounding box of a geometry as a typed `Box2D` value (four doubles: `xmin`, `ymin`, `xmax`, `ymax`).

`ST_Box2D` is the typed counterpart to [ST\_Envelope](/reference/wherobots-db/geometry-data/bounding-box/ST_Envelope). `ST_Envelope` returns the envelope as a `Geometry` — typically a polygon, but JTS may return a `Point` or `LineString` for degenerate inputs. `ST_Box2D` always returns a `Box2D` value that serializes to a struct of four non-nullable doubles and round-trips through Parquet without WKB overhead.

It is also produced by the SQL cast `CAST(geom AS box2d)`.

Returns `NULL` for `NULL` or empty geometry input.

## Signatures

```sql theme={"system"}
ST_Box2D(geom: Geometry)
```

## Parameters

<ParamField body="geom" type="Geometry" required>
  The geometry whose planar bounding box is returned.
</ParamField>

## Return type

<ResponseField type="Box2D">
  The planar bounding box as a `Box2D` value.
</ResponseField>

## Example

```sql theme={"system"}
SELECT ST_AsText(ST_Box2D(ST_GeomFromWKT('LINESTRING (0 0, 10 20)')))
```

```
BOX(0.0 0.0, 10.0 20.0)
```
