snowflake.snowpark.functions.st_npoints

snowflake.snowpark.functions.st_npoints(geography_or_geometry_expression: Union[snowflake.snowpark.column.Column, str]) Column[source]

Returns the number of points in a GEOGRAPHY or GEOMETRY object.

Parameters:

geography_or_geometry_expression (ColumnOrName) – A GEOGRAPHY or GEOMETRY objects.

Returns:

The number of points in the input object.

Return type:

Column

Examples::
>>> from snowflake.snowpark.functions import col, to_geometry
>>> df = session.create_dataframe([
...     ['POINT(66 12)'],
...     ['POLYGON((17 17, 17 30, 30 30, 30 17, 17 17))'],
...     ['LINESTRING(40 60, 50 50, 60 40)']
... ], schema=["geom"])
>>> df.select(st_npoints(to_geometry(df["geom"])).alias("npoints")).collect()
[Row(NPOINTS=1), Row(NPOINTS=5), Row(NPOINTS=3)]
Copy