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.geodataframe.GeoDataFrame.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:
GeoDataFrame
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
# 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 GeoDataFrame to select few columns and filter only 3D geometries
# in column 'points', then execute GeoDataFrame.mbb() function to get MBB representation of
# ST_Point/ST_MultiPoint geometries.
geodfmbb = geodf.select(["skey", "points", "linestrings"])[geodf.points.is_3D == 1].mbb()
# Set the geometry property of GeoDataFrame to point to 'linestrings' column.
geodfmbb.geometry = geodfmbb.linestrings
geodfmbb.intersects_mbb(geom_column=geodfmbb.mbb_points_geom)