st_npoints
function
Applies to: Databricks SQL
Databricks Runtime 17.1 and above
Preview
This feature is in Public Preview.
note
This feature is not available on Databricks SQL Classic warehouses. To learn more about Databricks SQL warehouses, see SQL warehouse types
Returns the number of non-empty points in the input GEOGRAPHY
or GEOMETRY
value.
Syntax
st_npoints ( geoExpr )
Arguments
geoExpr
: AGEOGRAPHY
orGEOMETRY
value.
Returns
A value of type INT
, representing the number of non-empty points in the input GEOGRAPHY
or GEOMETRY
value.
The function returns NULL
if the input is NULL
.
Examples
SQL
-- Returns the number of points in a non-empty multipoint geometry.
> SELECT st_npoints(st_geomfromtext('MULTIPOINT(10 34,44 57,EMPTY)'));
2
-- Returns the number of points in an empty multipoint geometry.
> SELECT st_npoints(st_geomfromtext('MULTIPOINT(EMPTY,EMPTY)'));
0
-- Returns the number of points in a non-empty polygon geometry.
> SELECT st_npoints(st_geomfromtext('POLYGON((0 0,1 0,1 1,0 1,0 0))'));
5