Compartir vía


st_setsrid Función

Se aplica a:check marcado yes Databricks SQL check marcado yes Databricks Runtime 17.1 y versiones posteriores

Important

Esta característica está en versión preliminar pública.

Nota:

Esta característica no está disponible en almacenes clásicos de Databricks SQL. Para más información sobre los almacenes de SQL de Databricks, consulte Tipos de almacenamiento de SQL.

Devuelve un valor nuevo GEOGRAPHY o GEOMETRY cuyo SRID es el valor SRID especificado.

Syntax

st_setsrid ( geo, srid )

Arguments

  • geo: un valor de GEOGRAPHY o GEOMETRY.
  • srid: El nuevo valor SRID de la geometría.

Returns

Valor de tipo GEOGRAPHY o GEOMETRY, que representa un nuevo valor de tipo geography o geometry cuyo SRID es el valor SRID especificado.

La función devuelve NULL si alguna de las entradas es 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)