Teradata Package for Python Function Reference | 17.10 - simplify - 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.simplify = simplify(self, tolerance)
DESCRIPTION:
    Simplifies a geometry by removing points that would fall within a
    specified distance tolerance.
    Notes:
        *  The simplification always returns a valid geometry.
        *  Simplified geometries require less storage space and fewer spatial
          operations during geospatial manipulations. Consequently, operations
          on simplified geometries generally perform faster.
        *  Smaller tolerance values result in a geometry closer to the input
          geometry, but will remove fewer vertices. Larger tolerance values
          will remove more vertices, but the resulting simplified geometry
          will be less similar to the original input.
 
PARAMETERS:
    tolerance:
        Required Argument.
        Specifies the distance tolerance for the simplification. The
        simplified line will never be farther away from the original line
        than the tolerance value.
        Types: float, str, ColumnExpression
 
SUPPORTED GEOMETRY TYPES:
    Valid on the following 2D geometries:
        LineString, MultiLineString, Polygon, and MultiPolygon.
    It is valid on these types within Geometry Collections. If method is called on other 2D
    geometries, those geometries are returned unchanged.
    This method is not valid on 3D geometries.
 
RAISES:
    TypeError, ValueError, TeradataMlException
 
RETURNS:
    GeoDataFrame with result column containing Geometry values
 
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)
    
    # Let's select only few columns from GeoDataFrame.
    pols_lines = geodf.select(["skey", "polygons", "linestrings"])[geodf.skey.isin([1001, 1002, 1003])]
 
    # Example 1: Simplify the geometry in column 'polygons' within a specified distance tolerance of 2.8.
    # Set the geometry property of GeoDataFrame to point to 'polygons' column.
    pols_lines.geometry = pols_lines.polygons
    pols_lines.simplify(2.8)
 
    # Example 2: Simplify the geometry in column 'linestrings' within a specified distance tolerance of 2.8.
    # Set the geometry property of GeoDataFrame to point to 'linestrings' column.
    pols_lines.geometry = pols_lines.linestrings
    pols_lines.simplify(tolerance=2.8)