ST_NumPoints takes a geometry column and returns an integer column. The output column represents the number of points in the input geometry.
Function | Syntax |
---|---|
Python | num |
SQL | ST |
Scala | num |
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
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
+----------+
|num_points|
+----------+
| 5|
| 9|
+----------+
Version table
Release | Notes |
---|---|
1.0.0-beta | Python, SQL, and Scala functions introduced |