st_setsrid 関数

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

Important

GEOGRAPHY 値のサポートは パブリック プレビュー段階です。 GEOMETRY 値のサポートが 一般公開されています

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

指定された SRID 値を持つ新しい GEOGRAPHY または GEOMETRY の値を返します。

Syntax

st_setsrid ( geo, srid )

Arguments

  • geo: GEOGRAPHY または GEOMETRY の値。
  • srid: ジオメトリの新しい SRID 値。

Returns

指定された SRID 値を持つ新しい地理情報または幾何学情報を表す GEOGRAPHY 型または GEOMETRY 型の値。

いずれかの入力がNULLされている場合、関数はNULLを返します。

Examples

-- Sets SRID to 3857 and returns the new SRID value.
> SELECT st_srid(st_setsrid(ST_GeomFromText('POINT(4 5)', 4326), 3857));
  3857

-- Returns the original geometry with the new SRID value.
> SELECT st_asewkt(st_setsrid(st_geomfromtext('POINT(1 2)'), 4326));
  SRID=4326;POINT(1 2)

-- Returns the original geography with the new SRID value.
> SELECT st_asewkt(st_setsrid(to_geography('POINT(1 2)'), 4326));
  SRID=4326;POINT(1 2)

-- When invoking st_setsrid with a literal for the SRID value, the output geography type inherits the SRID value.
> SELECT typeof(st_setsrid(to_geography('POINT(1 2)'), 4326));
  geography(4326)

-- When invoking st_setsrid with a literal for the SRID value, the output geometry type inherits the SRID value.
> SELECT typeof(st_setsrid(to_geometry('POINT(1 2)'), 3857));
  geometry(3857)