ST_TRANSFORM
functionsupportedCore SQL functionsConverts a GEOMETRY object from one spatial reference system (SRS) to another. Use this function to change the SRID and the coordinates of the object to match the new SRS (spatial reference system). If you just need to change the SRID without changing the coordinates (e.g. if the SRID was incorrect), use ST_SETSRID instead.
Syntax
supportedpartialnot supportednot scored
ST_TRANSFORM( <geometry_expression> [ , <from_srid> ] , <to_srid> );
Parameters
| Name | Required | Description |
|---|---|---|
geometry_expression | required | The argument must be of type GEOMETRY. |
to_srid | required | The spatial reference system identifier (SRID) that identifies the SRS to use. The function transforms the input GEOMETRY object to a new object that uses this SRS. |
from_srid | optional | The SRID identifying the current SRS of the input GEOMETRY object. If this argument is omitted, the function uses the SRID specified in the input GEOMETRY object. |
Returns
The function returns a GEOMETRY object that uses the SRS identified by to_srid.
Usage notes
- SRIDs are based on the EPSG standard (v10.082). For example, the SRID 4326 corresponds to the authority EPSG with the code 4326.
- Make sure that either the input GEOMETRY has the correct SRID set or that you specify the from_srid argument.
- Currently, the function does not support datum grid files. All transformations are performed using the static parameters of the datum without any grid file correction.
- If geometry_expression, from_srid, or to_srid are NULL, this function returns NULL.
- If from_srid or to_srid cannot be resolved to a valid SRID, an error occurs.