# Teradata Package for Python Function Reference | 17.10 - intersection - 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
Release Number
17.10
Published
April 2022
Language
English (United States)
Last Update
2022-08-19
lifecycle
previous
Product Category
DESCRIPTION:
Returns a Geometry type where the value represents the point set
intersection of two Geometry values.

PARAMETERS:
geom_column:
Required Argument.
Specifies the other Geometry value.
Types: str, ColumnExpression, GeometryType

SUPPORTED GEOMETRY TYPES:
All Geometry types, including GeoSequence, but not the ST_GeomCollection type.
Note:
This method can be called on 3D geometries (those that include Z
coordinates). However, the Z coordinate is ignored in method
calculations. Consequently, any Z coordinates returned by this
method should be ignored. Teradata recommends using the make_2D
method to strip out the Z coordinates of the return value.

RAISES:

RETURNS:
GeoDataFrame
Notes:
Returns a Geometry type where the representation is one of the
possible set of types in the following table, depending on the
parameter types.
+==============+=====+=====+==============+======+======+=======+=======+
| a n b        | Ø   | Pnt | Line, GeoSeq | Poly | MPnt | MLine | MPoly |
+==============+=====+=====+==============+======+======+=======+=======+
| Ø            | Ø   | Ø   | Ø            | Ø    | Ø    | Ø     | Ø     |
+--------------+-----+-----+--------------+------+------+-------+-------+
| Pnt          | Ø   | R09 | R09          | R09  | R09  | R09   | R09   |
+--------------+-----+-----+--------------+------+------+-------+-------+
| Line, GeoSeq | Ø   | R09 | R11          | R11  | R13  | R11   | R11   |
+--------------+-----+-----+--------------+------+------+-------+-------+
| Poly         | Ø   | R09 | R11          | R12  | R13  | R11   | R12   |
+--------------+-----+-----+--------------+------+------+-------+-------+
| MPnt         | Ø   | R09 | R13          | R13  | R13  | R13   | R13   |
+--------------+-----+-----+--------------+------+------+-------+-------+
| MLine        | Ø   | R09 | R11          | R11  | R13  | R11   | R11   |
+--------------+-----+-----+--------------+------+------+-------+-------+
| MPoly        | Ø   | R09 | R11          | R12  | R13  | R11   | R12   |
+--------------+-----+-----+--------------+------+------+-------+-------+
Where:
Pnt     = ST_Point
Line    = ST_LineString
Poly    = ST_Polygon
MPnt    = ST_MultiPoint
MLine   = ST_MultiLineString
MPoly   = ST_MultiPolygon
GeoSeq  = GeoSequence
R09     = Ø, ST_Point
R11     = Ø, ST_Point, ST_LineString, ST_MultiPoint, ST_MultiLineString
R12     = Ø, ST_Point, ST_LineString, ST_Polygon, ST_MultiPoint,
ST_MultiLineString, ST_MultiPolygon
R13     = Ø, ST_Point, ST_MultiPoint
Vantage converts GeoSequence types that are involved in the intersection()
method to ST_LineString values. Therefore, intersection() never returns a
GeoSequence type.

EXAMPLES:
from teradataml import Point, LineString, Polygon
# 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: Get the point set interection geometry value between the geometries in columns
#            'points' and 'linestrings'.
points_lines.intersection(geom_column=points_lines.linestrings)

# Example 2: Get the point set interection geometry value between the geometries in column
#            'linestrings' and geometry type specified by Linestring.
# Set the geometry property of GeoDataFrame to point to 'linestrings' column.
points_lines.geometry = points_lines.linestrings
# 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.
points_lines.intersection(l1)