Column Selection
polars_st.geom #
Create a geometry column expression.
Alias for
polars.col
.
If no name is given, the default from st.Config
will be used.
Parameters:
-
name
(str | Iterable[str] | None
, default:None
) –The name or datatype of the geometry column(s) to represent. Accepts regular expression input. Regular expressions should start with
^
and end with$
. -
more_names
(str
, default:()
) –Additional names or datatypes of columns to represent, specified as positional arguments.
Examples:
Pass a single column name to represent that column:
>>> gdf = st.GeoSeries("my_geom", ["POINT(0 0)"]).to_frame()
>>> gdf.select(st.geom("my_geom").st.to_wkt())
shape: (1, 1)
┌─────────────┐
│ my_geom │
│ --- │
│ str │
╞═════════════╡
│ POINT (0 0) │
└─────────────┘
Call geom
without a column name to use the default:
polars_st.element #
element() -> GeoExpr
Alias for polars.element
.
Examples:
>>> gdf = st.GeoDataFrame([
... "MULTIPOINT ((0 0), (1 2))"
... ])
>>> gdf.select(st.parts().list.eval(st.element().st.to_wkt()))
shape: (1, 1)
┌────────────────────────────────┐
│ geometry │
│ --- │
│ list[str] │
╞════════════════════════════════╡
│ ["POINT (0 0)", "POINT (1 2)"] │
└────────────────────────────────┘