Teradata Package for Python Function Reference on VantageCloud Lake | 17.20 - within_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 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.within_mbb = within_mbb(self, geom_column)
DESCRIPTION:
    Tests whether a 3D geometry is spatially within the bounds of a
    specified MBB.
 
PARAMETERS:
    geom_column:
        Required Argument.
        Specifies a minimum bounding box.
        Types: str, ColumnExpression, GeometryType
 
SUPPORTED GEOMETRY TYPES:
    All 3D Geometry types.
 
RAISES:
    TypeError, ValueError, TeradataMlException
 
RETURNS:
    GeoDataFrameColumn
    Resultant column contains:
        * 1, if the input 3D geometry is spatially within MBB argument.
        * 0, if the input 3D geometry is not spatially within 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 geometries in column 'points' is within the
    #            specified MBB geometries or not.
    # Let's select only few columns from GeoDataFrame and filter only 3D rows.
    geodfmbb = geodf.select(["skey", "points"]).mbb()[geodf.points.is_3D == 1]
    # Join the GeoDataFrameColumn with self.
    geodfmbb = geodfmbb.join(geodfmbb, how="cross", lsuffix="l", rsuffix="r")
    geodfmbb.assign(res = geodfmbb.l_points.within_mbb(geom_column=geodfmbb.r_mbb_points_geom))
 
    # Example 1: Filter all rows where the geometries in column 'points' is within the
    #            specified MBB geometry.
    geodfmbb[geodfmbb.l_points.within_mbb(geom_column=geodfmbb.r_mbb_points_geom) == 1]