snowflake.snowpark.functions.st_collect¶
- snowflake.snowpark.functions.st_collect(geography_expression_1: Union[snowflake.snowpark.column.Column, str], geography_expression_2: Union[snowflake.snowpark.column.Column, str] = None) Column[source]¶
Returns a GEOGRAPHY object that represents the collection of all input GEOGRAPHY objects.
- Parameters:
geography_expression_1 (ColumnOrName) – A GEOGRAPHY objects to collect
geography_expression_2 (ColumnOrName, optional) – An optional second GEOGRAPHY objects to collect
- Returns:
The collected GEOGRAPHY objects as a single GEOGRAPHY object
- Return type:
- Examples::
-
# Example with a single argument >>> df2 = session.create_dataframe([ … [‘POINT(10 20)’], … [‘POINT(30 40)’], … [‘POINT(50 60)’] … ], schema=[“g1”]) >>> df2.select(st_collect(to_geography(col(“g1”))).alias(“COLLECTED”)).collect() [Row(COLLECTED=’{n “coordinates”: [n [n 10,n 20n ],n [n 30,n 40n ],n [n 50,n 60n ]n ],n “type”: “MultiPoint”n}’)]