ST_Points

ST_Points takes a geometry column and returns an array column. For linestring and polygon geometries the function returns the vertices of the input geometry as an array of points. For multipoint and point geometries the function returns an array of all points in the input geometry.

FunctionSyntax
Pythonpoints(geometry)
SQLST_Points(geometry)
Scalapoints(geometry)

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

Examples

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

data = [
    ("POINT (10 30)",),
    ("MULTIPOINT (0 0, 5 5, 0 5)", ),
    ("LINESTRING (15 15, 10 15, 12 2)", ),
    ("POLYGON ((20 30, 18 28, 22 35, 40 20))", )
]

df = spark.createDataFrame(data, ["wkt"])\
          .select(ST.geom_from_text("wkt").alias("geometry"))

df.select(ST.points("geometry").alias("points")).show(truncate=False)
Result
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
+--------------------------------------------------------------------+
|points                                                              |
+--------------------------------------------------------------------+
|[{"x":10,"y":30}]                                                   |
|[{"x":0,"y":0}, {"x":5,"y":5}, {"x":0,"y":5}]                       |
|[{"x":15,"y":15}, {"x":10,"y":15}, {"x":12,"y":2}]                  |
|[{"x":20,"y":30}, {"x":18,"y":28}, {"x":22,"y":35}, {"x":40,"y":20}]|
+--------------------------------------------------------------------+

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.