Teradata Package for Python Function Reference on VantageCloud Lake | 17.20 - intersects - 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 on VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Package for Python
Release Number
17.20
Publication Date
November 2022
Content Type
Programming Reference
Publication ID
B700-4500-112K
ft:locale
en-US
ft:lastEdition
2024-02-21
ft:sourceId
FTML
dita:id
TeradataPython_FxRef_Lake_1720
Product Category
Teradata Vantage
teradataml.geospatial.geodataframecolumn.GeoDataFrameColumn.intersects = intersects(self, geom_column)
DESCRIPTION:
    Tests if a Geometry value spatially intersects another Geometry value.
    Note:
        *  Using a geospatial index can greatly improve the performance of
          queries that use this method.
 
PARAMETERS:
    geom_column:
        Required Argument.
        Specifies the other Geometry value.
        Types: str, ColumnExpression, GeometryType
 
SUPPORTED GEOMETRY TYPES:
    All Geometry types except geometry collections.
    Note:
        This method can be called on 3D geometries (those that include Z
        coordinates). However, the Z coordinate is ignored in method
        calculations.
 
RAISES:
    TypeError, ValueError, TeradataMlException
 
RETURNS:
    GeoDataFrameColumn
    Resultant column contains:
        * 1, if the geometries intersect
        * 0, if the geometries do not intersect
 
EXAMPLES:
    from teradataml import GeoDataFrame, load_example_data
    from teradataml import Point, LineString, Polygon, GeometryCollection
    # Load example data.
    load_example_data("geodataframe", "sample_shapes")
    # Create a GeoDataFrame.
    geodf = GeoDataFrame("sample_shapes")
    print(geodf)
 
    # Let's select only few columns from GeoDataFrame.
    points_lines = geodf.select(["skey", "points", "linestrings"])
 
    # Example 1: Check whether the ST_Point/ST_MultiPoint type geometries in column
    #            'points' intersects with ST_Linestring/ST_MultiLinestring geometries
    #            in column 'linestrings'.
    geo_intersects1 = points_lines.points.intersects(geom_column=points_lines.linestrings)
    points_lines.assign(res = geo_intersects1)
 
    # Example 2: Check whether the ST_Linestring/ST_MultiLinestring type geometries in column
    #            'linestrings' intersects with GeometryType object of Linestring.
    # Create an object of Linestring GeometryType.
    l1 = LineString([(1,3), (3,0), (0,1)])
    # Pass the LineString() GeometryType object as input to "geom_column" argument.
    geo_intersects2 = points_lines.linestrings.intersects(geom_column=l1)
    points_lines.assign(res = geo_intersects2)
 
    # Example 3: Get all the rows where the ST_Point/ST_MultiPoint type geometries in column
    #            'points' intersects with ST_Linestring/ST_MultiLinestring geometries
    #            in column 'linestrings'.
    geo_intersects1 = points_lines.points.intersects(geom_column=points_lines.linestrings)
    points_lines[geo_intersects1 == 1]