st_setsrid-Funktion

Gilt für:check marked yes Databricks SQL check marked yes Databricks Runtime 17.1 and above

Important

Unterstützung für GEOGRAFIE-Werte befindet sich in der öffentlichen Vorschau. Die Unterstützung für GEOMETRY-Werte ist allgemein verfügbar.

Hinweis

Dieses Feature ist in Databricks SQL Classic Warehouses nicht verfügbar. Weitere Informationen zu Databricks SQL Warehouses finden Sie unter SQL Warehouse-Typen.

Gibt einen neuen GEOGRAPHY- oder GEOMETRY-Wert zurück, dessen SRID der angegebene SRID-Wert ist.

Syntax

st_setsrid ( geo, srid )

Arguments

  • geo: Ein GEOGRAPHY- oder GEOMETRY-Wert.
  • srid: Der neue SRID-Wert der Geometrie.

Returns

Ein Wert vom Typ GEOGRAPHY oder GEOMETRY, der einen neuen geographischen oder geometrischen Wert darstellt, dessen SRID der angegebene SRID-Wert ist.

Die Funktion gibt zurück NULL , wenn eine der Eingaben lautet 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)