> ## 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_AsHEXEWKB

This function returns the input geometry encoded to a text representation in HEXEWKB format. The HEXEWKB encoding can use either little-endian (NDR) or big-endian (XDR) byte ordering. If no encoding is explicitly specified, the function defaults to using the little-endian (NDR) format.

## Signatures

```sql theme={"system"}
ST_AsHEXEWKB(geom: Geometry, endian: String = NDR)
```

## Parameters

<ParamField body="geom" type="Geometry" required>
  The input geometry.
</ParamField>

<ParamField body="endian" type="String" required default="NDR">
  The endian value.
</ParamField>

## Return type

<ResponseField type="String">
  A string representation.
</ResponseField>

## Examples

```sql theme={"system"}
SELECT ST_AsHEXEWKB(ST_GeomFromWKT('POINT(1 2)'), 'XDR')
```

```
00000000013FF00000000000004000000000000000
```

```sql theme={"system"}
SELECT ST_AsHEXEWKB(ST_GeomFromWKT('LINESTRING (30 20, 20 25, 20 15, 30 20)'))
```

```
0102000000040000000000000000003E4000000000000034400000000000003440000000000000394000000000000034400000000000002E400000000000003E400000000000003440
```
