Teradata Package for Python Function Reference | 17.10 - geom_equals - 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.geom_equals = geom_equals(self, geom_column)
DESCRIPTION:
    Tests if a Geometry value is spatially equal to 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.
 
RAISES:
    TypeError, ValueError, TeradataMlException
 
RETURNS:
    GeoDataFrameColumn
    Resultant column contains:
        * 1, if the geometries are spatially equal
        * 0, if the geometries are not spatially equal
 
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' equals geometry specified by a GeometryType object - Point.
    # Create an object of Point GeometryType.
    p1 = Point(10, 20)
    # Pass the Point() GeometryType object as input to "geom_column" argument.
    ge_expr = points_lines.geometry.geom_equals(geom_column=p1)
    points_lines.assign(res = ge_expr)
 
    # Example 2: Get all rows where he ST_Linestring/ST_MultiLinestring type geometries in column
    #            'linestrings' is not equal to geometry specified by a GeometryType object - 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.
    ge_expr = points_lines.linestrings.geom_equals(geom_column=l1)
    points_lines[ge_expr != 1] # One can use [ge_expr == 0] as well.