Teradata Package for Python Function Reference | 20.00 - LineString - 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 - 20.00

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
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_Enterprise_2000
lifecycle
latest
Product Category
Teradata Vantage

 
teradataml.geospatial.geometry_types.LineString = class LineString(GeometryType)
    teradataml.geospatial.geometry_types.LineString(coordinates=None)
 
Class LineString enables end user to create an object for the single
LineString using the coordinates. Allows user to use the same in
GeoDataFrame manipulation and processing.
 
 
Method resolution order:
LineString
GeometryType
builtins.object

Methods defined here:
__init__(self, coordinates=None)
DESCRIPTION:
    Enables end user to create an object for the single LineString
    using the coordinates. Allows user to use the same in GeoDataFrame
    manipulation and processing using any Geospatial function.
 
PARAMETERS:
    coordinates:
        Optional Argument.
        Specifies the coordinates of a Line. While passing coordinates
        for a line, one must always pass coordinates in list of either
        two-tuples for 2D or list of three-tuples for 3D.
        Argument also accepts list of Point as well instead of tuples.
        If coordinates are not passed, an object for empty line is
        created.
        Types: List of
                a. Point geometry objects or
                b. two-tuple of int or float or
                c. three-tuple of int or float or
                d. Mix of any of the above.
 
RETURNS:
    LineString
 
RAISES:
    TeradataMlException, TypeError, ValueError
 
EXAMPLES:
    >>> from teradataml import Point, LineString
 
    # Example 1: Create a LineString in 2D, using x and y coordinates.
    >>> l1 = LineString([(0, 0), (0, 20), (20, 20)])
    >>> # Print the coordinates.
    >>> print(l1.coords)
    [(0, 0), (0, 20), (20, 20)]
    >>> # Print the geometry type.
    >>> l1.geom_type
    'LineString'
    >>>
 
    # Example 2: Create a LineString in 3D, using x, y and z coordinates.
    >>> l2 = LineString([(0, 0, 1), (0, 1, 3), (1, 3, 6), (3, 3, 6),
    ...                  (3, 6, 1), (6, 3, 3), (3, 3, 0)])
    >>> # Print the coordinates.
    >>> print(l1.coords)
    [(0, 0), (0, 20), (20, 20)]
    >>>
 
    # Example 3: Create a LineString using Point geometry objects.
    # Create some Points in 2D, using x and y coordinates.
    >>> p1 = Point(0, 20)
    >>> p2 = Point(0, 0)
    >>> p3 = Point(20, 20)
    >>> l3 = LineString([p1, p2, p3])
    >>> # Print the coordinates.
    >>> print(l3.coords)
    [(0, 20), (0, 0), (20, 20)]
    >>>
 
    # Example 4: Create a LineString using mix of Point geometry objects
    #            and coordinates.
    >>> p1 = Point(0, 20)
    >>> p2 = Point(20, 20)
    >>> l4 = LineString([(0, 0), p1, p2, (20, 0)])
    >>> # Print the coordinates.
    >>> print(l4.coords)
    [(0, 0), (0, 20), (20, 20), (20, 0)]
    >>>
 
    # Example 5: Create an empty LineString.
    >>> le = LineString()
    >>> # Print the coordinates.
    >>> print(le.coords)
    EMPTY
    >>>

Methods inherited from GeometryType:
__getattr__(self, item)
__str__(self)
Return String Representation for a Geometry object.

Readonly properties inherited from GeometryType:
coords
Returns the coordinates of the Geometry object.
geom_type
Returns the type of a Geometry.