Returns an ST_Geometry value transformed to the specified spatial reference system.
Argument … |
Specifies … |
toSRSid |
an INTEGER that is the identifier of the spatial reference system returned by the method. |
toWktSRS |
a VARCHAR(2048) for the WKT representation of the spatial reference system to transform to. |
fromWktSRS |
a VARCHAR(2048) for the WKT representation of the spatial reference system to assign to the geometry value (without any transformation) before transforming it to the spatial reference system specified by toWktSRS. |
Returns an ST_Geometry value.
All ST_Geometry types.
Note: This method can be called on 3D geometries (those that include z coordinates). However, the z coordinate is ignored in method calculations. Consequently, any z coordinates returned by this method should be ignored. Teradata recommends using the Make_2D method to strip out the z coordinates of the return value.
The SRTEXT column of the SYSSPATIAL.SPATIAL_REF_SYS metadata table contains WKT representations of spatial reference systems.
SELECT R.skey, R.shape.ST_Transform(X.srtext, Y.srtext)
FROM sample_shapes R ,
SYSSPATIAL.SPATIAL_REF_SYS X ,
SYSSPATIAL.SPATIAL_REF_SYS Y
WHERE X.AUTH_SRID = 4326 and Y.AUTH_SRID = 3149;
The following example demonstrates the use of the toSRSid argument.
CREATE TABLE customers(pkey INTEGER, point ST_Geometry);
INSERT INTO customers VALUES(0, new ST_Geometry('POINT(-89.39 43.09)', 1619));
INSERT INTO customers VALUES(1, new ST_Geometry('POINT(-87.65 41.90)', 1619));
CREATE TABLE transformed_customers2(pkey INTEGER, point ST_Geometry);
INSERT INTO transformed_customers2
SELECT pkey,
point.ST_Transform(3054, X.srtext, Y.srtext)
FROM customers,
SYSSPATIAL.SPATIAL_REF_SYS X,
SYSSPATIAL.SPATIAL_REF_SYS Y
WHERE X.AUTH_SRID = 32616 AND -- UTM 16 / WGS84
Y.AUTH_SRID = 4326 -- WGS84
;
;SELECT pkey,
point.ST_SRID(),
point
FROM transformed_customers2
ORDER BY pkey;
pkey point.ST_SRID() point
----------- --------------- ------------------------------------------------
0 3054 POINT (305475.753263251972385 4773581.672131018)
1 3054 POINT (446084.218845848692581 4638877.682686116)