st_transform Funzione

Si applica a:spuntato sì Databricks SQL contrassegnato sì Databricks Runtime 17.1 e superiori spuntati spuntati sì Lakehouse//RT

Annotazioni

Questa funzionalità non è disponibile in Databricks SQL Classic Warehouses. Per altre informazioni sui databricks SQL Warehouse, vedere Tipi di SQL Warehouse.

Trasforma le coordinate X e Y della geometria di input dal sistema di riferimento delle coordinate corrente (CRS) al sistema di riferimento alle coordinate descritto dal valore SRID fornito.

Syntax

st_transform ( geo, srid )

Arguments

  • geo: Un GEOMETRY valore.
  • srid: Il valore SRID del nuovo sistema di riferimento di coordinate (CRS) a cui la geometria di ingresso deve essere trasformata.

Returns

Valore di tipo GEOMETRY, che rappresenta la geometria trasformata.

Se la geometria ha coordinate Z e M, saranno presenti nella geometria di output e non verranno modificate.

Lo SRID dell'output GEOMETRY è uguale al valore SRID di input.

La funzione restituisce NULL se uno degli input è NULL.

Condizioni di errore

Examples

-- Transforms coordinates from WGS84 to Web Mercator.
> SELECT st_astext(st_transform(st_geomfromtext('MULTIPOINT Z (4 5 14,-3 8 27,EMPTY)', 4326), 3857));
  MULTIPOINT Z ((445277.96317309426 557305.2572745768 14),(-333958.4723798207 893463.751012646 27),EMPTY)

-- Returns geometry in new coordinate system.
> SELECT st_srid(st_transform(st_geomfromtext('POINT(0 0)', 4326), 3857));
  3857

-- When invoking st_transform with a literal for the SRID value, the output geometry type inherits the SRID value.
> SELECT typeof(st_transform(st_geomfromtext('POINT(0 0)', 4326), 4267));
  geometry(4267)