ST_NUMPOINTS()
All functions > GEOSPATIAL > ST_NUMPOINTS()
Returns the total number of vertices in a geometry or geography.
Signatures
Number of points
Returns: Total vertex count
ST_NUMPOINTS(geo: T) → BIGINT sql
| Parameter | Type | Required | Description |
|---|---|---|---|
geo | T | Yes | Geometry or geography value |
With:
T: Custom types: GEOM_POINT | GEOM_LINESTRING | GEOM_POLYGON | GEOM_MULTIPOINT | GEOM_MULTILINESTRING | GEOM_MULTIPOLYGON | GEOM_MULTIANY | GEOG_POINT | GEOG_LINESTRING | GEOG_POLYGON | GEOG_MULTIPOINT | GEOG_MULTILINESTRING | GEOG_MULTIPOLYGON | GEOG_MULTIANY
Signature notes:
- Counts all vertices across all sub geometries
- Point returns 1, empty geometry returns 0
- On DuckDB and DataFusion: transpiled to ST_NPoints
- Returns NULL if the input is NULL
Examples
FeatureQL
SELECT
f1 := ST_NUMPOINTS(ST_GEOMPOINT(1.0, 2.0)), -- Point has 1 vertex
f2 := ST_NUMPOINTS(ST_GEOMFROMTEXT('POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))')) -- Closed polygon ring has 5 vertices (first == last)
;Result
| f1 BIGINT | f2 BIGINT |
|---|---|
| 1 | 5 |
On this page