snowflake.snowpark.functions.st_union_agg¶
- snowflake.snowpark.functions.st_union_agg(geography_column: Union[snowflake.snowpark.column.Column, str]) Column[source]¶
Returns the union of all geography objects in a group as a single geography object.
- Parameters:
geography_column (ColumnOrName) – The geography objects to union.
- Returns:
The union of all geography objects in the group.
- Return type:
- Examples::
>>> from snowflake.snowpark.functions import to_geography >>> df = session.create_dataframe([ ... ['POINT(1 1)'], ... ['POINT(0 1)'], ... ['LINESTRING(0 0, 0 1)'], ... ['POLYGON((10 10, 11 11, 11 10, 10 10))'] ... ], schema=["g"]) >>> df.select(st_union_agg(to_geography(df["g"])).alias("union_result")).collect() [Row(UNION_RESULT='{\n "geometries": [\n {\n "coordinates": [\n 9.999999999999998e-01,\n 1.0000000000000...00000000000000e+01\n ]\n ]\n ],\n "type": "Polygon"\n }\n ],\n "type": "GeometryCollection"\n}')]