Configuration
polars_st.Config #
Config(geometry_column: str | None = None)
Bases: ContextDecorator
Configuration object for polars-st
.
Parameters:
-
geometry_column
(str | None
, default:None
) –Default geometry column name. Using
None
will reset this value to the built-in default"geometry"
.
Examples:
Use as a context manager:
>>> gdf = st.GeoSeries("my_geometry", ["POINT(1 2)"]).to_frame()
>>> with st.Config(geometry_column="my_geometry"):
... x = gdf.select(st.x())
>>> x.schema
Schema({'my_geometry': Float64})
Use as a context decorator:
>>> @st.Config(geometry_column="my_geometry")
... def get_my_bounds(gdf):
... return gdf.select(st.bounds())
>>> gdf = st.GeoSeries("my_geometry", ["POINT(1 2)"]).to_frame()
>>> bounds = get_my_bounds(gdf)
>>> bounds.schema
Schema({'my_geometry': Array(Float64, shape=(4,))})
Use as a global configuration object: