

 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\$1NPoints
<a name="ST_NPoints-function"></a>

ST\$1NPoints 會回輸入幾何或地理中非空點的數量。

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

```
ST_NPoints(geo)
```

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

 *geo*   
`GEOMETRY` 或 `GEOGRAPHY` 資料類型的值，或是評估為 `GEOMETRY` 或 `GEOGRAPHY` 類型的運算式。

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

`INTEGER`

如果 *geo* 是空點，則傳回 `0`。

如果 *geo* 為 null，則傳回 null。

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

以下 SQL 會傳回 linestring 中點的數量。

```
SELECT ST_NPoints(ST_GeomFromText('LINESTRING(77.29 29.07,77.42 29.26,77.27 29.31,77.29 29.07)'));
```

```
st_npoints
-------------
 4
```

以下 SQL 會傳回地理中 linestring 中點的數量。

```
SELECT ST_NPoints(ST_GeogFromText('LINESTRING(110 40, 2 3, -10 80, -7 9)'));
```

```
st_npoints
-------------
 4
```