Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to: Databricks Runtime 17.1 and above
Important
This feature is in Public Preview.
Returns the type of the input GEOGRAPHY
or GEOMETRY
value as a string.
Syntax
st_geometrytype ( geoExpr )
Arguments
geoExpr
: AGEOGRAPHY
orGEOMETRY
value.
Returns
A value of type STRING
, representing the type of the input geometry.
The value returned is as follows:
- For points, the expression returns
ST_Point
. - For linestrings, the expression returns
ST_LineString
. - For polygons, the expression returns
ST_Polygon
. - For multipoints, the expression returns
ST_MultiPoint
. - For multilinestrings, the expression returns
ST_MultiLineString
. - For multipolygons, the expression returns
ST_MultiPolygon
. - For geometry collections, the expression returns
ST_GeometryCollection
.
The function returns NULL
if the input is NULL
.
Examples
-- Returns the type of a point geometry.
> SELECT st_geometrytype(st_geomfromtext('POINT(4 5)'))
ST_Point
-- Returns the type of a geometry collection.
> SELECT st_geometrytype(st_geomfromtext('GEOMETRYCOLLECTION(POINT(4 5),LINESTRING(-4 5,7 8))'))
ST_GeometryCollection