snowflake.snowpark.functions.st_makeline¶
- snowflake.snowpark.functions.st_makeline(geography_or_geometry_expression_1: Union[snowflake.snowpark.column.Column, str], geography_or_geometry_expression_2: Union[snowflake.snowpark.column.Column, str]) Column[source]¶
Returns a LINESTRING geography object by connecting the input geography objects in the order they are passed to the function.
- Parameters:
geography_or_geometry_expression_1 (ColumnOrName) – A GEOGRAPHY or GEOMETRY object that represents the first point or set of points in the line.
geography_or_geometry_expression_2 (ColumnOrName) – A GEOGRAPHY or GEOMETRY object that represents the second point or set of points in the line.
- Returns:
A LINESTRING geography object connecting the input geography objects.
- Return type:
- Examples::
>>> from snowflake.snowpark.functions import to_geography >>> df = session.create_dataframe([ ... ["POINT(37.0 45.0)", "POINT(38.5 46.5)"], ... ["POINT(-122.306067 37.55412)", "MULTIPOINT((-122.32328 37.561801), (-122.325879 37.586852))"] ... ], schema=["geog1", "geog2"]) >>> df.select(st_makeline(to_geography(df["geog1"]), to_geography(df["geog2"])).alias("makeline")).collect() [Row(MAKELINE='{\n "coordinates": [\n [\n 37,\n 45\n ],\n [\n 38.5,\n 46.5\n ]\n ],\n "type": "LineString"\n}'), Row(MAKELINE='{\n "coordinates": [\n [\n -122.306067,\n 37.55412\n ],\n [\n -122.32328,\n 37.561801\n ],\n [\n -122.325879,\n 37.586852\n ]\n ],\n "type": "LineString"\n}')]