---
title: getBytes (Geography)
description: "Geography.getBytes method in PySpark: Returns the WKB of Geography."
canonical_url: https://docs.databricks.com/gcp/en/pyspark/reference/classes/geography/getBytes
---

# getBytes (Geography)

Returns the WKB of Geography.

## Syntax

```
getBytes()
```

## Returns

`bytes`

## Examples

```python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([ {'geogwkt': '''POINT(17 7)'''} ])
g = df.select(dbf.st_geogfromwkt(df.geogwkt).alias("geog")).head().geog
g.getBytes().hex()
# '010100000000000000000031400000000000001c40'
```
