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

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.geodataframe.GeoDataFrame.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:
    GeoDataFrame
    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
    # 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 withing 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 GeoDataFrame with self.
    geodfmbb = geodfmbb.join(geodfmbb, how="cross", lsuffix="l", rsuffix="r")
    geodfmbb.within_mbb(geom_column=geodfmbb.r_mbb_points_geom)