Repository navigation
Accept a Polars DataFrame with geometries as WKB, such as polars-st - #275
Merged
Merged
Conversation
A Polars DataFrame with a column of geometries as WKB or EWKB (the GeoDataFrame of polars-st) is read as a GeoDataFrame: shapely.from_wkb reads the column at once, the other columns become the properties, and a shared SRID becomes the CRS. A Series of WKB and a list of DataFrames with object_name work too. Polars and polars-st are not imported by topojson. The types of Extract are looked up in a table instead of a chain of elifs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
…method Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
This was referenced Oct 14, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
tp.Topologyaccepts a Polars DataFrame with a column of geometries as WKB or EWKB, such as the GeoDataFrame of polars-st:shapely.from_wkbreads the columngeometry(or else the onlyBinarycolumn) at once; the other columns become the properties, as for a GeoDataFrame. A shared SRID (EWKB) becomes the CRS, also ofto_gdf().object_namework too.shapely.to_wkb, so they run without polars-st and with Polars 2;polarsis added to thedevextras.docsextras pinpolars<2next to polars-st, as polars-st 0.10 does not import with Polars 2 (Fix import on Polars 2 (GeoSeries metaclass conflict) oreilles/polars-st#85, not released yet).elif; a new type is one line.Africa from a Polars DataFrame gives the same arcs and objects as from a GeoDataFrame. Of the inputs, a Polars DataFrame is the quickest to extract: the geometries are read in one call, and Polars gives its rows as dictionaries quicker than pandas. Most of Extract is still the loop per feature, the same for every input, which a vectorized path (
shapely.get_rings,get_coordinates) could avoid.Not yet:
sync()(incremental updates) takes a GeoDataFrame only, and there is noto_polars().🤖 Generated with Claude Code