Teradata Package for Python Function Reference on VantageCloud Lake | 17.20 - spheroidal_distance - 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 on VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Package for Python
Release Number
17.20
Publication Date
November 2022
Content Type
Programming Reference
Publication ID
B700-4500-112K
ft:locale
en-US
ft:lastEdition
2024-02-21
ft:sourceId
FTML
dita:id
TeradataPython_FxRef_Lake_1720
Product Category
Teradata Vantage
teradataml.geospatial.geodataframe.GeoDataFrame.spheroidal_distance = spheroidal_distance(self, geom_column, semimajor=6378137.0, invflattening=298.257223563)
DESCRIPTION:
    Returns the distance, in meters, between two spherical coordinates.
    Notes:
        *  For the distance calculation, the planet is modeled as a spheroid.
        *  If you do not pass in values for the "semimajor" and "invflattening"
          arguments, the computation uses the semimajor axis and the inverse
          flattening ratio from the World Geodetic System, WGS84. A value of
          6,378,137.0 meters is used for the semimajor axis, and a value of
          298.257223563 is used for the inverse flattening ratio.
        *  Distance calculations between antipodal or nearly antipodal points
          using the spheroidal_distance() method may fail to converge,
          generating a Vantage error. For these distance
          calculations use instead the spherical_distance() method.
 
PARAMETERS:
    geom_column:
        Required Argument.
        Specifies a Geometry for the other coordinate.
        Types: str, ColumnExpression, GeometryType
 
    semimajor:
        Optional Argument.
        Specifies the length in meters of the semimajor axis of the
        spheroid.
        Default Value: 6378137.0
        Types: float, int
 
    invflattening:
        Optional Argument.
        Specifies the inverse flattening ratio of the spheroid.
        Default Value: 298.257223563
        Types: float, int
 
SUPPORTED GEOMETRY TYPES:
    ST_Point
 
RAISES:
    TypeError, ValueError, TeradataMlException
 
RETURNS:
    GeoDataFrame
 
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.
    points = geodf.select(["skey", "points"])[geodf.skey.isin([1001, 1002, 1003])]
    points = points.join(points, how="cross", lsuffix="l", rsuffix="r")
 
    # Example 1: Get the spheroidal distance between two points from columns 'l_points' and 'r_points'.
    points.spheroidal_distance(points.r_points)
 
    # Example 2: Get the spheroidal distance between points from column 'l_points' and
    #            a GeometryType object Point.
    # Create an object of Point GeometryType.
    p1 = Point(1,3)
    # Pass the Point() GeometryType object as input to "geom_column" argument.
    points.spheroidal_distance(geom_column=p1, semimajor=637813, invflattening=298)