Creates a copy of the geometry value transformed into the specified spatial reference system.
geometry-expression.ST_Transform(srid)
Name | Type | Description |
---|---|---|
srid |
INT |
The SRID of the result. |
Returns a copy of the geometry value transformed into the specified spatial reference system.
The spatial reference system identifier of the result is the given by parameter srid.
The ST_Transform method transforms geometry-expression from its spatial reference system to the specified spatial reference system using the transform definition of both spatial reference systems. The transformation is performed using the PROJ.4 library.
ST_Transform is required to move between different coordinate systems. For example, use can use ST_Transform to transform a geometry which uses latitude and longitude to a geometry with the SRID 3310 "NAD83 / California Albers". The "NAD83 / California Albers" spatial reference system is a planar projection for California data which uses the Albers projection algorithm and metres for its linear unit of measure.
Transformations from a lat/long system to a Cartesian system can be problematic for polar points. If the database server is unable to transform a point close to the North or South pole, the latitude value of the point is shifted a small distance (slightly more than 1e-10 radians) away from the pole, and along the same longitude, so that the transformation can succeed.
If you are transforming a geometry between two spatial reference systems that have the same coordinate system, you can use the ST_SRID method instead of ST_Transform.
The spatial tutorial includes steps showing you how to transforming data between spatial reference systems.
5.1.6
The following example returns the result Point (184755.86861 -444218.175691). It transforms a point in Los Angeles which is specified in longitude and latitude to the projected planar SRID 3310 ("NAD83 / California Albers"). This example assumes that the 'st_geometry_predefined_srs' feature has been installed by the sa_install_feature system procedure. See sa_install_feature system procedure.
SELECT NEW ST_Point( -118, 34, 4326 ).ST_Transform( 3310 )