MultiPolygon | Geospatial Types | Teradata Package for Python - MultiPolygon - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

This function enables end user to create an object holding the multiple Polygon geometry objects. It allows user to use the same in GeoDataFrame manipulation and processing using any Geospatial function.

Optional argument:

polygon: Specifies the list of Polygon objects. If no polygons are passed, an object for empty MultiPolygon is created.

Example 1: Create a MultiPolygon in 2D, using x and y coordinates

>>> from teradataml import Polygon, MultiPolygon
>>> po1 = Polygon([(0, 0), (0, 20), (20, 20), (20, 0), (0, 0)])
>>> po2 = Polygon([(0.6, 0.8), (0.6, 20.8), (20.6, 20.8), (20.6, 0.8), (0.6, 0.8)])
>>> go1 = MultiPolygon([po1, po2])
>>> # Print the coordinates.
>>> print(go1.coords)
[[(0, 0), (0, 20), (20, 20), (20, 0), (0, 0)], [(0.6, 0.8), (0.6, 20.8), (20.6, 20.8), (20.6, 0.8), (0.6, 0.8)]]
>>> # Print the geometry type.
>>> print(go1.geom_type)
MultiPolygon

Example 2: Create an empty MultiPolygon

>>> from teradataml import Polygon, MultiPolygon
>>> poe = MultiPolygon()
>>> # Print the coordinates.
>>> print(poe.coords)
EMPTY