snowflake.snowpark.functions.st_symdifference¶
- snowflake.snowpark.functions.st_symdifference(geography_expression_1: Union[snowflake.snowpark.column.Column, str], geography_expression_2: Union[snowflake.snowpark.column.Column, str]) Column[source]¶
Returns the symmetric difference of two GEOGRAPHY objects. The symmetric difference consists of all points that are in either geography but not in both.
- Parameters:
geography_expression_1 (ColumnOrName) – A GEOGRAPHY object or a string representation of a geography.
geography_expression_2 (ColumnOrName) – A GEOGRAPHY object or a string representation of a geography.
- Returns:
A GEOGRAPHY object representing the symmetric difference of the two input geographies.
- Return type:
- Examples::
>>> from snowflake.snowpark.functions import to_geography >>> df = session.create_dataframe([ ... ["POLYGON((0 0, 1 0, 2 1, 1 2, 2 3, 1 4, 0 4, 0 0))", "POLYGON((3 0, 3 4, 2 4, 1 3, 2 2, 1 1, 2 0, 3 0))"] ... ], schema=["geog1", "geog2"]) >>> result = df.select(st_symdifference(to_geography(df["geog1"]), to_geography(df["geog2"])).alias("symmetric_difference")).collect() >>> # Returns a MultiPolygon representing the symmetric difference