Teradata Package for Python Function Reference | 17.10 - speed - 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.geodataframecolumn.GeoDataFrameColumn.speed = speed(self, index=None, begin_index=None, end_index=None)
DESCRIPTION:
    Returns the approximate speed at a specified point (speed(index
    INTEGER)) or between two points (speed(iBegin INTEGER, iEnd INTEGER))
    for a GeoSequence type.
    Notes:
        * If "begin_index" and "end_index" arguments are passed, then
          the speed is calculated as the distance between the two points
          (along the LineString) divided by the time between them.
        * If "index" is passed, then if the point is:
            * The first point, the distance between the first and second
              points is divided by the time between them.
            * The last point, the distance between the second to the last
              and last points is divided by the time between them.
            * Any other point, the distance between the previous point
              and the next point (along the LineString) is divided by the
              time difference between the previous point and the next point.
        * The units used for distance are the same units that are used by
          the coordinate system for the GeoSequence value, and the time
          units are in hours.
 
 
PARAMETERS:
    index:
        Optional Argument.
        Specifies the index of the point within the GeoSequence type,
        where the index of the first point is 1.
        Default Value: None
        Types: int, str, ColumnExpression
 
    begin_index:
        Optional Argument.
        Specifies the index of the starting point for which to
        calculate the speed, where the index of the first point in a
        GeoSequence type is 1.
        Default Value: None
        Types: int, str, ColumnExpression
 
    end_index:
        Optional Argument.
        Specifies the index of the ending point for which to calculate
        the speed, where the index of the first point in a GeoSequence is 1.
        Default Value: None
        Types: int, str, ColumnExpression
 
SUPPORTED GEOMETRY TYPES:
    GeoSequence
 
RAISES:
    TypeError, ValueError, TeradataMlException
 
RETURNS:
    GeoDataFrameColumn
 
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.
    geoseq = geodf.select(["skey", "geosequence"])[geodf.skey.isin([1001, 1002])]
 
    # Example 1: Get the approximate speed at a point specified at 1st index for Geosequence geometries.
    geoseq.assign(res = geoseq.geosequence.speed(index=1))
 
    # Example 2: Get the approximate speed between points at 1st and 2nd index for Geosequence geometries.
    geoseq.assign(res = geoseq.geosequence.speed(begin_index=1, end_index=2))