Teradata Package for Python Function Reference | 17.10 - transform - Teradata Package for Python - Look here for syntax, methods and examples for the functions included in the Teradata Package for Python.

Teradata® Package for Python Function Reference

Product
Teradata Package for Python
Release Number
17.10
Published
April 2022
Language
English (United States)
Last Update
2022-08-19
lifecycle
previous
Product Category
Teradata Vantage
teradataml.geospatial.geodataframecolumn.GeoDataFrameColumn.transform = transform(self, to_wkt_srs, from_wkt_srs, to_srsid=-12345)
DESCRIPTION:
    Returns a Geometry value transformed to the specified spatial reference
    system.
    Note:
        *  The SRTEXT column of the SYSSPATIAL.SPATIAL_REF_SYS metadata table
          contains WKT representations of spatial reference systems.
 
PARAMETERS:
    to_wkt_srs:
        Required Argument.
        Specifies a value that is the identifier of the spatial reference
        system returned by the method.
        Types: str, ColumnExpression
 
    from_wkt_srs:
        Required Argument.
        Specifies a value for the WKT representation of the spatial
        reference system to transform to.
        Types: str, ColumnExpression
 
    to_srsid:
        Optional Argument.
        Specifies a value 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 "to_wkt_srs".
        Default Value: -12345
        Types: int, str, ColumnExpression
 
SUPPORTED GEOMETRY TYPES:
    All 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.
 
RAISES:
    TypeError, ValueError, TeradataMlException
 
RETURNS:
    GeoDataFrameColumn containing Geometry values
 
EXAMPLES:
    from teradataml import DataFrame, in_schema
    from teradataml import GeoDataFrame, load_example_data
    # Load example data.
    load_example_data("geodataframe", "sample_shapes")
    # Create a GeoDataFrame.
    geodf = GeoDataFrame("sample_shapes")
    print(geodf)
 
    # Create a teradataml DataFrame on 'SYSSPATIAL.SPATIAL_REF_SYS'
    sysref = DataFrame(in_schema("SYSSPATIAL", "SPATIAL_REF_SYS"))
 
    # Join the teradataml GeoDataFrame and DataFrame.
    sysref = sysref.join(sysref, how="cross", lsuffix="l", rsuffix="r")
    geodf_sysref = geodf.join(sysref, on="skey==l_SRID")
 
    # Execute the transform function to transform geometry in column 'points'.
    trans = geodf_sysref.points.transform(geodf_sysref.l_SRTEXT, geodf_sysref.r_SRTEXT)
    geodf_sysref.assign(res = trans)