snowflake.snowpark.functions.st_dimension¶
- snowflake.snowpark.functions.st_dimension(geography_or_geometry_expression: Union[snowflake.snowpark.column.Column, str]) Column[source]¶
Returns the dimension of a GEOGRAPHY or GEOMETRY object.
- Parameters:
geography_or_geometry_expression (ColumnOrName) – A GEOGRAPHY or GEOMETRY object
- Returns:
The dimension of the input object (0 for points, 1 for lines, 2 for polygons)
- Return type:
- Examples::
>>> from snowflake.snowpark.functions import to_geometry >>> df = session.create_dataframe([ ... ['POINT(-122.35 37.55)'], ... ['LINESTRING(-124.20 42.00, -120.01 41.99)'], ... ['POLYGON((-124.20 42.00, -120.01 41.99, -121.1 42.01, -124.20 42.00))'] ... ], schema=["geom"]) >>> df.select(st_dimension(to_geometry(df["geom"])).alias("dimension")).collect() [Row(DIMENSION=0), Row(DIMENSION=1), Row(DIMENSION=2)]