snowflake.snowpark.functions.st_contains¶
- snowflake.snowpark.functions.st_contains(geography_or_geometry_expression_1: Union[snowflake.snowpark.column.Column, str], geography_or_geometry_expression_2: Union[snowflake.snowpark.column.Column, str]) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.42.0/src/snowflake/snowpark/_functions/scalar_functions.py#L2360-L2387)¶
Returns True if the first geography expression completely contains the second geography expression.
- Parameters:
geography_or_geometry_expression_1 (ColumnOrName) – The geography expression that potentially contains the second expression
geography_or_geometry_expression_2 (ColumnOrName) – The geography expression to test for containment within the first expression
- Returns:
A boolean column indicating whether the first geography contains the second
- Return type:
- Examples::
>>> from snowflake.snowpark.functions import col, to_geography >>> df = session.create_dataframe([ ... ['POLYGON((0 0, 3 0, 3 3, 0 3, 0 0))', 'POLYGON((1 1, 2 1, 2 2, 1 2, 1 1))'], ... ['POLYGON((-2 0, 0 2, 2 0, -2 0))', 'POLYGON((-1 0, 0 1, 1 0, -1 0))'] ... ], schema=["g1", "g2"]) >>> df.select(st_contains(to_geography(col("g1")), to_geography(col("g2"))).alias("contains_result")).collect() [Row(CONTAINS_RESULT=True), Row(CONTAINS_RESULT=False)]