Teradata Package for Python Function Reference | 17.10 - geom_component - 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.geodataframe.GeoDataFrame.geom_component = geom_component(self, position)
DESCRIPTION:
    Returns the geometry of one component member of a composite geometry
    type (ST_GeomCollection, ST_MultiPoint, ST_MultiLineString, or
    ST_MultiPolygon). The element to be returned is specified by position
    with the collection.
 
PARAMETERS:
    position:
        Required Argument.
        Specifies a value representing the position in the collection of the
        geometry to be returned. The position of the first element in the
        collection is number 1.
        Types: int, str, ColumnExpression
 
SUPPORTED GEOMETRY TYPES:
    ST_GeomCollection, ST_MultiPoint, ST_MultiLineString, and ST_MultiPolygon
 
RAISES:
    TypeError, ValueError, TeradataMlException
 
RETURNS:
    GeoDataFrame with result column containing Geometry values
 
EXAMPLES:
    from teradataml import GeoDataFrame, load_example_data
    from teradataml import Point, LineString, Polygon
    # Load example data.
    load_example_data("geodataframe", "sample_shapes")
    # Create a GeoDataFrame.
    geodf = GeoDataFrame("sample_shapes")
    print(geodf)
    
    # Example 1: Get the geometry component at position 1 in ST_GeometryCollection, a composite geometry type,
    #            geometries in column 'geom_collections'.
    geom_collections = geodf.select(["skey", "geom_collections"])
    geom_collections.geom_component(position=1)