snowflake.snowpark.functions.st_makepolygon¶
- snowflake.snowpark.functions.st_makepolygon(geography_or_geometry_expression: Union[snowflake.snowpark.column.Column, str]) Column[source]¶
Creates a polygon from a linestring that represents the exterior ring.
- Parameters:
geography_or_geometry_expression (ColumnOrName) – A column or column name containing a GEOGRAPHY or GEOMETRY object representing a linestring that forms the exterior ring of the polygon.
- Returns:
A new column containing the polygon created from the input linestring.
- Return type:
- Examples::
>>> from snowflake.snowpark.functions import to_geometry >>> df = session.create_dataframe([["LINESTRING(0.0 0.0, 1.0 0.0, 1.0 2.0, 0.0 2.0, 0.0 0.0)"]], schema=["linestring"]) >>> df.select(st_makepolygon(to_geometry(df["linestring"])).alias("polygon")).collect() [Row(POLYGON='{\n "coordinates": [\n [\n [\n 0.000000000000000e+00,\n 0.000000000000000e+00\n ],\n [\n 1.000000000000000e+00,\n 0.000000000000000e+00\n ],\n [\n 1.000000000000000e+00,\n 2.000000000000000e+00\n ],\n [\n 0.000000000000000e+00,\n 2.000000000000000e+00\n ],\n [\n 0.000000000000000e+00,\n 0.000000000000000e+00\n ]\n ]\n ],\n "type": "Polygon"\n}')]