ST_GeometryType takes a geometry column and returns a string column. The string indicates the type of each input geometry
(i.e. '
, '
, '
, or '
).
Function | Syntax |
---|---|
Python | geometry |
SQL | ST |
Scala | 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
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
+-------------+
|geometry_type|
+-------------+
| Point|
| MultiPoint|
| Linestring|
| Polygon|
+-------------+
Version table
Release | Notes |
---|---|
1.0.0-beta | Python, SQL, and Scala functions introduced |