try_to_geography fonksiyon

Şunun için geçerlidir:evet olarak işaretlendi Databricks SQL denetimi evet olarak işaretlendi Databricks Runtime 17.1 ve üzeri

Important

Bu özellik Genel Önizleme aşamasındadır.

Uyarı

Bu özellik Databricks SQL Klasik ambarlarında kullanılamaz. Databricks SQL ambarları hakkında daha fazla bilgi edinmek için bkz. SQL ambar türleri.

Bir coğrafyanın giriş açıklamasını ayrıştırır ve ilgili GEOGRAPHY değerini döndürür veya giriş açıklaması geçersizse NULL değerini döndürür. Döndürülen GEOGRAPHY değerin SRID değeri 4326'dır.

Syntax

try_to_geography ( geoRepExpr )

Arguments

Returns

Giriş coğrafyası açıklamasına karşılık gelen GEOGRAPHY(ANY), türünde bir değer.

  • İşlev, birinci parametre NULL ise NULL döndürür.
  • Giriş NULL veya BINARY değerinin bir coğrafyayı geçersiz şekilde tanımlaması durumunda işlev STRING döndürür.

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 geometry is in EWKT format.
> SELECT concat_ws(';', st_srid(g)::STRING, st_asgeojson(g)) FROM (SELECT try_to_geography('SRID=4326;POINT Z (3 4 5)') AS g);
  4326;{"type":"Point","coordinates":[3,4,5]}

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