次の方法で共有


try_to_geography 関数

適用対象:はい Databricks SQL チェックが Databricks Runtime 17.1 以降" とマークされているチェック

Important

この機能は パブリック プレビュー段階です

この機能は、Databricks SQL クラシック ウェアハウスでは使用できません。 Databricks SQL ウェアハウスの詳細については、 SQL ウェアハウスの種類に関するページを参照してください。

geography の入力説明を解析し、対応する GEOGRAPHY 値を返します。入力の説明が無効な場合は NULL します。 返される GEOGRAPHY 値の SRID 値は 4326 です。

Syntax

try_to_geography ( geoRepExpr )

Arguments

  • geoRepExpr: BINARYSTRING、または GeoJSON の geography を表す式または式。

Returns

入力 geography の説明に対応する GEOGRAPHY(ANY)型の値。

  • 入力がNULL場合、この関数はNULLを返します。
  • 入力NULLまたはBINARY値が地理の無効な説明である場合、この関数はSTRINGを返します。

Examples

-- Input geography is in WKT format.
> SELECT st_asgeojson(try_to_geography('POINT Z (3 4 5)'));
  {"type":"Point","coordinates":[3,4,5]}

-- Input geography is in GeoJSON format.
> SELECT st_asewkt(try_to_geography('{"type":"Point","coordinates":[3,4,5]}'));
  SRID=4326;POINT Z (3 4 5)

-- Input geography is in WKB format.
> SELECT st_astext(try_to_geography(X'01b90b0000000000000000084000000000000010400000000000001440000000000000f0bf'))
  POINT ZM (3 4 5 -1)

-- Input value is not the description of a geography.
> SELECT st_astext(try_to_geography('some string that does not represent a geography'))
  NULL