---
title: h3_centeraswkb function
description: Learn the syntax of the h3\_centeraswkb function of the SQL language in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/functions/h3_centeraswkb
---

# `h3_centeraswkb` function

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime 11.3 LTS and above ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Lakehouse//RT

Returns the center of the input H3 cell as a point in [WKB](https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry#Well-known_binary) format.

## Syntax

```
h3_centeraswkb ( h3CellIdExpr )
```

## Arguments

* `h3CellIdExpr`: A BIGINT expression, or a hexadecimal STRING expression representing an H3 cell ID.

## Returns

A value of the type BINARY representing the center of the input H3 cell as a point in [WKB](https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry#Well-known_binary) format.

The function returns NULL if the input expression is NULL.
The function does partial validation regarding whether the input argument is a valid H3 cell ID. A necessary, but not sufficient condition for a valid H3 ID is that its value is between `0x08001fffffffffff` and `0x08ff3b6db6db6db6`.
The behavior of the function is undefined if the input cell ID is not a valid cell ID.

## Error conditions

* If `h3CellIdExpr` is a STRING that cannot be converted to a BIGINT or corresponds to a BIGINT value that is smaller than `0x08001fffffffffff` or larger than `0x08ff3b6db6db6db6`, the function returns [H3\_INVALID\_CELL\_ID](https://docs.databricks.com/aws/en/error-messages/h3-invalid-cell-id-error-class.md).

## Examples

```sql
-- Input a BIGINT representing a hexagonal cell.
> SELECT hex(h3_centeraswkb(599686042433355775));
  0101000000F5ACA5F17C7E5EC0833013F542AC4240

-- Input a STRING representing a pentagonal cell.
> SELECT hex(h3_centeraswkb('8009fffffffffff'));
  01010000009D8F6AAF881225404E2B56CDCC2C5040

-- Input is an invalid H3 cell ID.
> SELECT h3_centeraswkb(0);
  [H3_INVALID_CELL_ID] 0 is not a valid H3 cell ID
```

## Related functions

* [`h3_boundaryasgeojson` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/h3_boundaryasgeojson.md)
* [`h3_boundaryaswkb` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/h3_boundaryaswkb.md)
* [`h3_boundaryaswkt` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/h3_boundaryaswkt.md)
* [`h3_centerasgeojson` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/h3_centerasgeojson.md)
* [`h3_centeraswkt` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/h3_centeraswkt.md)
