ST_NumPoints

ST_NumPoints takes a geometry column and returns an integer column. The output column represents the number of points in the input geometry.

FunctionSyntax
Pythonnum_points(geometry)
SQLST_NumPoints(geometry)
ScalanumPoints(geometry)

For more details, go to the GeoAnalytics for Microsoft Fabric API reference for num_points.

This function implements the OpenGIS Simple Features Implementation Specification for SQL 1.2.1.

Examples

PythonPythonSQLScala
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
from geoanalytics_fabric.sql import functions as ST

data = [
    ("POLYGON ((20 30, 18 28, 22 35, 40 20))", ),
    ("POLYGON ((35 10, 45 45, 15 40, 10 20), (20 30, 35 35, 30 20))",)
]

df = spark.createDataFrame(data, ["wkt"]) \
    .withColumn("polygon", ST.poly_from_text("wkt", 4326))

df.select(ST.num_points("polygon").alias("num_points")).show()
Result
Use dark colors for code blocksCopy
1
2
3
4
5
6
+----------+
|num_points|
+----------+
|         5|
|         9|
+----------+

Version table

ReleaseNotes

1.0.0-beta

Python, SQL, and Scala functions introduced

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.