Teradata Package for Python Function Reference | 17.10 - intersects_mbb - 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.intersects_mbb = intersects_mbb(self, geom_column)
DESCRIPTION:
    Tests whether a 3D geometry spatially intersects a specified MBB.
 
PARAMETERS:
    geom_column:
        Required Argument.
        Specifies a minimum bounding box.
        Types: str, ColumnExpression, GeometryType
 
SUPPORTED GEOMETRY TYPES:
    3D Point, 3D MultiPoint, 3D LineString, 3D MultiLineString
 
RAISES:
    TypeError, ValueError, TeradataMlException
 
RETURNS:
    GeoDataFrameColumn
    Resultant column contains:
        * 1, if the input 3D geometry intersects the MBB argument.
        * 0, if the input 3D geometry does not intersect the MBB argument.
        * Returns an error if the input geometry is not 3D (does not have
          a z coordinate).
 
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)
 
    # Example 1: Check whether the 3D ST_Linestring/ST_MultiLinestring geometries
    #            in column 'linestrings' intersects with MBB or not.
    # First, let's process the GeoDataFrameColumn to select few columns and filter only 3D geometries
    # in column 'points', then execute GeoDataFrameColumn.mbb() function to get MBB representation of
    # ST_Point/ST_MultiPoint geometries.
    geodfmbb = geodf.select(["skey", "points", "linestrings"])[geodf.points.is_3D == 1].mbb()
    geo_im = geodfmbb.linestrings.intersects_mbb(geom_column=geodfmbb.mbb_points_geom)
    geodfmbb.assign(res = geo_im)
 
    # Example 2: Filter all the rows where the 3D ST_Linestring/ST_MultiLinestring geometries
    #            in column 'linestrings' intersects with mbb.
    geodfmbb[geo_im == 1]