Teradata Package for Python Function Reference on VantageCloud Lake - union - 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
- 20.00.00.03
- Published
- December 2024
- ft:locale
- en-US
- ft:lastEdition
- 2024-12-19
- dita:id
- TeradataPython_FxRef_Lake_2000
- Product Category
- Teradata Vantage
- teradataml.geospatial.geodataframecolumn.GeoDataFrameColumn.union = union(self, geom_column)
- DESCRIPTION:
Returns a Geometry value that represents the point set union of two
Geometry values.
PARAMETERS:
geom_column:
Required Argument.
Specifies the other Geometry value.
Types: str, ColumnExpression, GeometryType
SUPPORTED GEOMETRY TYPES:
All Geometry types except geometry collections.
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:
TypeError, ValueError, TeradataMlException
RETURNS:
GeoDataFrameColumn
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 u b | Ø | Pnt | Line, GeoSeq | Poly | MPnt | MLine | MPoly |
+==============+=====+=====+==============+======+======+=======+=======+
| Ø | Ø | R01 | R02 | R03 | R04 | R05 | R06 |
+--------------+-----+-----+--------------+------+------+-------+-------+
| Pnt | R01 | R20 | R15 | R22 | R04 | R17 | R19 |
+--------------+-----+-----+--------------+------+------+-------+-------+
| Line, GeoSeq | R02 | R15 | R16 | R21 | R15 | R16 | R18 |
+--------------+-----+-----+--------------+------+------+-------+-------+
| Poly | R03 | R22 | R21 | R23 | R22 | R21 | R23 |
+--------------+-----+-----+--------------+------+------+-------+-------+
| MPnt | R04 | R04 | R15 | R22 | R04 | R17 | R19 |
+--------------+-----+-----+--------------+------+------+-------+-------+
| MLine | R05 | R17 | R16 | R21 | R17 | R16 | R18 |
+--------------+-----+-----+--------------+------+------+-------+-------+
| MPoly | R06 | R19 | R18 | R23 | R19 | R18 | R23 |
+--------------+-----+-----+--------------+------+------+-------+-------+
Where:
Pnt, R09 = ST_Point
Line, R02 = ST_LineString
Poly, R03 = ST_Polygon
MPnt, R04 = ST_MultiPoint
MLine, R05 = ST_MultiLineString
MPoly, R06 = ST_MultiPolygon
GeoSeq = GeoSequence
R15 = ST_LineString,
ST_GeomCollection of ST_Point and ST_LineString values
R16 = ST_LineString, ST_MultiLineString
R17 = ST_MultiLineString,
ST_GeomCollection of ST_Point and ST_LineString values
R18 = ST_MultiPolygon,
ST_GeomCollection of ST_LineString and ST_Polygon values
R19 = ST_MultiPolygon,
ST_GeomCollection of ST_Point and ST_Polygon values
R20 = ST_Point, ST_MultiPoint
R21 = ST_Polygon,
ST_GeomCollection of ST_LineString and ST_Polygon values
R22 = ST_Polygon,
ST_GeomCollection of ST_Point ST_Polygon values
R23 = ST_Polygon, ST_MultiPolygon
Vantage converts GeoSequence types that are involved in the union()
method to ST_LineString values. Therefore, union() never returns a
GeoSequence type.
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)
# Let's select only few columns from GeoDataFrame.
pols_lines = geodf.select(["skey", "polygons", "linestrings"])[geodf.skey.isin([1001, 1002, 1003])]
# Example 1: Get the point set union of geometries in columns 'polygons' and 'linestrings'.
pols_lines.assign(res = pols_lines.linestrings.union(geom_column=pols_lines.polygons))
# Example 2: Get the point set union of geometries in column 'polygons' and
# a GeometryType object - Polygon.
# Create an object of Polygon GeometryType.
po1 = Polygon([(0, 0), (0, 20), (20, 20), (20, 0), (0, 0)])
# Pass the Polygon() GeometryType object as input to "geom_column" argument.
pols_lines.assign(res = pols_lines.polygons.union(po1))