snowflake.snowpark.functions.st_intersection_agg

snowflake.snowpark.functions.st_intersection_agg(geography_column: Union[snowflake.snowpark.column.Column, str]) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.41.0/src/snowflake/snowpark/_functions/scalar_functions.py#L2575-L2599)

Returns the intersection of all geography objects in a group as an aggregate function.

Parameters:

geography_column (ColumnOrName) – A column containing geography objects to find the intersection of in a group.

Returns:

A column containing the intersection of all geography objects in the group

Return type:

Column

Examples::
>>> from snowflake.snowpark.functions import to_geography
>>> df = session.create_dataframe([
...     ['POLYGON((10 10, 11 11, 11 10, 10 10))'],
...     ['POLYGON((10 10, 11 10, 10 11, 10 10))'],
...     ['POLYGON((10.5 10.5, 10 10, 11 10, 10.5 10.5))']
... ], schema=["g"])
>>> df.select(st_intersection_agg(to_geography(df["g"])).alias("intersection")).collect()
[Row(INTERSECTION='{\n  "coordinates": [\n    [\n      [\n        1.050000000000000e+01,\n        1.050000000000000e+01\n      ...     ],\n      [\n        1.050000000000000e+01,\n        1.050000000000000e+01\n      ]\n    ]\n  ],\n  "type": "Polygon"\n}')]
Copy
Language: English