GeoSequence | Geospatial Types | Teradata Package for Python - GeoSequence - Teradata Package for Python

Teradata® Package for Python User Guide

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Package for Python
Release Number
20.00
Published
March 2024
Language
English (United States)
Last Update
2024-04-09
dita:mapPath
nvi1706202040305.ditamap
dita:ditavalPath
plt1683835213376.ditaval
dita:id
rkb1531260709148
Product Category
Teradata Vantage

This function enables end user to create an object holding the LineString geometry objects with tracking information such as timestamps. It allows user to use the same in GeoDataFrame manipulation and processing using any Geospatial function.

Optional arguments:
  • coordinates: Specifies the coordinates of a Point.
    • If coordinates are not passed, an object for empty line is created.
    • When coordinates are passed, you must pass a list of the following types:

      - Two-tuple of int or float;

      - Three-tuple of int or float;

      - Point geometry objects;

      - Mix of any of these three types.

  • timestamps: Specifies a list of timestamp values for each coordinate in the following format: yyyy-mm-dd hh:mi:ss.ms.

    The first timestamp value is associated with the first point, the second timestamp value is associated with the second point, and so forth.

    Total number of timestamp values must match the total number of points in the GeoSequence.
  • link_ids: Specifies the list of values for the ID of the link on the road network for a point in the GeoSequence.

    The first link ID value is associated with the first point, the second link ID value is associated with the second point, and so forth.

    Total number of link ID values must match the total number of points in the GeoSequence.
  • user_field_count: Specifies the value that represents the number of user field elements for each point in the GeoSequence.

    The default value 0 indicates that no user field elements appear after count in the character string.

  • user_fields: Specifies the list of user field tuples that represents a value associated with a Point.

    For example, certain tracking systems may associate velocity, direction, and acceleration values with each point.

    • You must specify count groups of n user field values (where n is the number of points in the geosequence).
    • The first group provides the first user field values for each point, the second group provides the second user field values for each point, and so forth.
    • Each group can be formed using a tuple.

Example 1: Create a GeoSequence with 2D Points and no user fields

>>> from teradataml import Point, GeoSequence
>>> coordinates = [(1, 3), (3, 0), (0, 1)]
>>> timestamps = ["2008-03-17 10:34:03.53", "2008-03-17 10:38:25.21", "2008-03-17 10:41:41.48"]
>>> link_ids = [1001, 1002, 1003]
>>> gs1 = GeoSequence(coordinates=coordinates, timestamps=timestamps, link_ids=link_ids)
>>> gs1.coords
[(1, 3), (3, 0), (0, 1)]
>>> str(gs1)
'GeoSequence((1 3, 3 0, 0 1), (2008-03-17 10:34:03.53, 2008-03-17 10:38:25.21, 2008-03-17 10:41:41.48), (1001, 1002, 1003), (0))

Example 2: Create a GeoSequence with 3D Points and 2 user fields

Coordinates can be provided as tuple of ints or floats, or Point objects.
>>> from teradataml import Point, GeoSequence
>>> p1 = (3, 0, 6)
>>> coordinates = [(1, 3, 6), p1, (6, 0, 1)]
>>> timestamps = ["2008-03-17 10:34:03.53", "2008-03-17 10:38:25.21", "2008-03-17 10:41:41.48"]
>>> link_ids = [1001, 1002, 1003]
>>> user_fields = [(1, 2), (3, 4), (5, 6)]
>>> gs2 = GeoSequence(coordinates=coordinates, timestamps=timestamps, link_ids=link_ids, user_field_count=2, user_fields=user_fields)
>>> gs2.coords
[(1, 3, 6), (3, 0, 6), (6, 0, 1)]
>>> str(gs2)
'GeoSequence((1 3 6, 3 0 6, 6 0 1), (2008-03-17 10:34:03.53, 2008-03-17 10:38:25.21, 2008-03-17 10:41:41.48), (1001, 1002, 1003), (2, 1, 2, 3, 4, 5, 6))'

Example 3: Create an empty GeoSequence

>>> from teradataml import Point, GeoSequence
>>> gs3 = GeoSequence()
>>> # Print the coordinates.
>>> print(gc3.coords)
EMPTY