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 Engine API reference for geometry_type.

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

Examples

PythonPythonSQLScala
1
2
3
4
5
6
7
8
9
10
11
12
13
14

from geoanalytics.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
1
2
3
4
5
6
7
8
+-------------+
|geometry_type|
+-------------+
|        Point|
|   MultiPoint|
|   Linestring|
|      Polygon|
+-------------+

Version table

ReleaseNotes

1.0.0

Python and SQL functions introduced

1.5.0

Scala function introduced

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

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close