Del via


st_setsrid function

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 17.1 and above

Important

This feature is in Public Preview.

Note

This feature is not available on Databricks SQL Classic warehouses. To learn more about Databricks SQL warehouses, see SQL warehouse types.

Returns a new GEOGRAPHY or GEOMETRY value whose SRID is the specified SRID value.

Syntax

st_setsrid ( geo, srid )

Arguments

  • geo: A GEOGRAPHY or GEOMETRY value.
  • srid: The new SRID value of the geometry.

Returns

A value of type GEOGRAPHY or GEOMETRY, representing a new geography or geometry value whose SRID is the specified SRID value.

The function returns NULL if any of the inputs is 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)