共用方式為


st_geometrytype函式

適用於:核取標示為是 Databricks SQL 核取標示為是 Databricks Runtime 17.1 和更新版本

Important

這項功能目前處於 公開預覽版

備註

這項功能不適用於 Databricks SQL Classic 倉儲。 若要深入瞭解 Databricks SQL 倉儲,請參閱 SQL 倉儲類型

傳回輸入 GEOGRAPHYGEOMETRY 值的型別做為字串。

Syntax

st_geometrytype ( geoExpr )

Arguments

  • geoExpr: GEOGRAPHYGEOMETRY 值。

Returns

類型為 STRING 的值,表示輸入幾何圖形的類型。

傳回的值如下所示:

  • 對於點,表示式會傳回ST_Point
  • 對於線串,表示式會傳回ST_LineString
  • 針對多邊形,表示式會傳回 ST_Polygon
  • 針對多點,表示式會傳回ST_MultiPoint
  • 對於多行字串 (multilinestring),該表示式會返回 ST_MultiLineString
  • 若為多邊形,表示式會傳回ST_MultiPolygon
  • 針對 geometry 集合,表示式會回傳 ST_GeometryCollection

如果輸入為 NULL,則函式會傳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