

 Amazon Redshift 將不再支援從修補程式 198 開始建立新的 Python UDFs。現有 Python UDF 將繼續正常運作至 2026 年 6 月 30 日。如需詳細資訊，請參閱[部落格文章](https://aws.amazon.com/blogs/big-data/amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026/)。

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# ST\$1GeoHash
<a name="ST_GeoHash-function"></a>

ST\$1GeoHash 會傳回具有指定精確度的輸入點的 `geohash` 表示法。預設精確度為 20。如需 geohash 定義的相關資訊，請參閱 Wikipedia 中的 [Geohash](https://en.wikipedia.org/wiki/Geohash)。

## 語法
<a name="ST_GeoHash-function-syntax"></a>

```
ST_GeoHash(geom)
```

```
ST_GeoHash(geom, precision)
```

## 引數
<a name="ST_GeoHash-function-arguments"></a>

 *geom*   
`GEOMETRY` 資料類型的值，或是評估為 `GEOMETRY` 類型的表達式。

 *precision*   
`INTEGER` 資料類型的值。預設值為 20。

## 傳回類型
<a name="ST_GeoHash-function-return"></a>

`GEOMETRY`

函數會傳回輸入點的 `geohash` 表示。

如果輸入點為空，該函數傳回 null。

如果輸入幾何不是點，則函數會傳回錯誤。

## 範例
<a name="ST_GeoHash-function-examples"></a>

以下 SQL 會傳回輸入點的 geohash 表示法。

```
SELECT ST_GeoHash(ST_GeomFromText('POINT(45 -45)'), 25) AS geohash;
```

```
          geohash
---------------------------
 m000000000000000000000gzz
```

下列 SQL 傳回 null，因為輸入點是空的。

```
SELECT ST_GeoHash(ST_GeomFromText('POINT EMPTY'), 10) IS NULL AS result;
```

```
 result
---------
 true
```