ST_GeometryType

ST_GeometryType takes a geometry column and returns a string column. The string indicates the type of each input geometry (i.e. 'Point', 'MultiPoint', 'Linestring', or 'Polygon').

FunctionSyntax
Pythongeometry_type(geometry)
SQLST_GeometryType(geometry)
ScalageometryType(geometry)

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

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
14
15
from geoanalytics_fabric.sql import functions as ST

data = [
    ("POINT (-2533858.73 8107527.81)",),
    ("MULTIPOINT (-3159938.72 8190159.75, -3046133.91 8190159.75, -3188072.29 8103229.92)", ),
    ("LINESTRING (-3636954.77 7750916.26, -3168756.90 7966747.98, -3124795.45 7893415.62)", ),
    ("POLYGON ((-2299937.47 8474247.90, -2543511.83 8425946.52, -2488034.02 8322274.98, -2299937.47 8474247.90))", )
]

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

df.select(ST.geometry_type("geometry").alias("geometry_type")).show()
Result
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
+-------------+
|geometry_type|
+-------------+
|        Point|
|   MultiPoint|
|   Linestring|
|      Polygon|
+-------------+

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.