Teradata Package for Python Function Reference | 17.10 - make_2D - Teradata Package for Python
Teradata® Package for Python Function Reference
- Teradata Package for Python
- Release Number
- April 2022
- English (United States)
- Last Update
- Product Category
- Teradata Vantage
- teradataml.geospatial.geodataframe.GeoDataFrame.make_2D = make_2D(self, validate=False)
Converts a 3D Geometry value to a 2D Geometry value, and optionally
validates that the 2D geometry is well-formed. This method strips the z
coordinate from 3D geometries.
* The is_valid method can be used to validate converted 2D
geometries that were not validated by make_2D().
* If the input geometry is already a 2D geometry value, this value is
returned unchanged by this method.
* A well-formed 3D geometry value can become invalid during a 3D to 2D
conversion. For example, if a 3D polygon lies in a plane parallel to
the y axis, its line segments will self-intersect. make_2D() does not
attempt to change the geometry type of the converted geometry from
polygon to linestring to account for this, and an invalid 2D
geometry can result.
Specifies a value that determines whether the converted 2D geometry
is tested to ensure it is well-formed. When "validate" is set to True,
the 2D geometry is tested. If it is not well-formed, Vantage
returns an error. If validate is set to False or is not specified,
the 2D geometry is not tested.
Default Value: False
Types: bool, str, ColumnExpression
SUPPORTED GEOMETRY TYPES:
All Geometry types.
TypeError, ValueError, TeradataMlException
from teradataml import GeoDataFrame, load_example_data
from teradataml import Point, LineString, Polygon
# Load example data.
# Create a GeoDataFrame.
geodf = GeoDataFrame("sample_shapes")
# Example 1: Convert 3D ST_Point/ST_MultiPoint geometries in column 'points' to 2D.
# Let's select only few columns from GeoDataFrame and get only rows which contains 3D geometries.
points = geodf.select(["skey", "points"])[geodf.points.is_3D == 1]