st_geomfromwkb 功能

適用於:勾選為是 Databricks SQL 勾選為是 Databricks Runtime 17.1 及以上版本 勾 選 是 Lakehouse//RT

備註

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

剖析幾何的 WKB 描述,並傳回對應的 GEOMETRY 值。 傳回 GEOMETRY 值的 SRID 值是 如果指定,則為 sridExpr 的值,否則為 0。

Syntax

st_geomfromwkb ( wkbExpr[, sridExpr] )

Arguments

  • wkbExpr: 一個 BINARY 值,代表 WKB 格式的幾何體。
  • sridExpr: 一個可選 INTEGER 值,設定為回傳 GEOMETRY 值的 SRID。

Returns

型GEOMETRY(srid)的值,如果srid是常數(可折疊的)表達式,那麼sridExpr的值是sridExpr,否則是GEOMETRY(ANY)。 如果 sridExpr 省略 ,則傳回值的型別為 GEOMETRY(0)。 傳回的值是對應至輸入 WKB 描述的幾何。

如果任何輸入為 NULL,則函式會傳NULL回 。

錯誤條件

  • 如果的值 wkbExpr 是無效的 WKB 描述,函式會 傳回WKB_PARSE_ERROR。
  • 如果 sridExpr 的值不被支援,函式會傳回 ST_INVALID_SRID_VALUE。

Examples

-- Simple example where we do not specify the output SRID. It defaults to 0. Input is in little-endian format.
> SELECT st_asewkt(st_geomfromwkb(X'01D1070000000000000000244000000000000041400000000000003740'));
  POINT M (10 34 23)

-- Simple example where we do not specify the output SRID. It defaults to 0. Input is in big-endian format.
> SELECT st_asewkt(st_geomfromwkb(X'00000007D1402400000000000040410000000000004037000000000000'));
  POINT M (10 34 23)

-- Simple example where we specify the SRID value for the output.
> SELECT st_asewkt(st_geomfromwkb(X'01D1070000000000000000244000000000000041400000000000003740', 3857));
  SRID=3857;POINT M (10 34 23)

-- When invoking st_geomfromwkb with a literal for the SRID value, the output geometry type inherits the SRID value.
> SELECT typeof(st_geomfromwkb(X'01D1070000000000000000244000000000000041400000000000003740', 4269));
  geometry(4269)