Teradata Package for Python Function Reference | 20.00 - crosses - 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 - 20.00

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Package for Python
Release Number
20.00
Published
March 2024
Language
English (United States)
Last Update
2024-04-10
dita:id
TeradataPython_FxRef_Enterprise_2000
Product Category
Teradata Vantage
teradataml.geospatial.geodataframe.GeoDataFrame.crosses = crosses(self, geom_column)
DESCRIPTION:
    Tests if a Geometry value spatially crosses 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:
    GeoDataFrame
    Resultant column contains:
        * 1, if the geometries cross
        * 0, if the geometries do not cross
 
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)
    
    # Let's select only few columns from GeoDataFrame.
    points_lines = geodf.select(["skey", "points", "linestrings"])
 
    # Example 1: Check if the ST_Linestring/ST_MultiLinestring type geometries in column
    #            'linestrings' crosses the geometries in column 'points' of type ST_Point/ST_MultiPoint.
    # Set the geometry property of GeoDataFrame to point to 'linestrings' column.
    points_lines.geometry = points_lines.linestrings
    # Pass the GeoDataFrameColumn object of 'points' columns as input to "geom_column" argument.
    points_lines.crosses(geom_column=points_lines.points)
 
    # Example 2: Check if the ST_Linestring/ST_MultiLinestring type geometries in column
    #            'linestrings' crosses the geometry specified by a GeometryType object - LineString.
    # Create an object of Linestring GeometryType.
    line1 = LineString([(3, 1), (0,2)])
    # Pass the Linestring() GeometryType object as input to "geom_column" argument.
    points_lines.crosses(geom_column=line1)