jiayuasu opened a new pull request, #1052:
URL: https://github.com/apache/sedona-db/pull/1052
Prototype of a **GeoPandas-compatible API** on top of SedonaDB, as a new
pure-Python package `sedonadb-geopandas` (structured like `sedonadb-expr`). It
provides `GeoDataFrame` / `GeoSeries` wrappers whose methods mirror GeoPandas
but delegate to lazy SedonaDB expressions via the `.geo` accessor.
```python
import geopandas, sedonadb_geopandas as sgpd
gdf = sgpd.from_geopandas(geopandas.read_file("cities.geojson"))
big = gdf[gdf["pop"] > 1_000_000] # boolean-mask filter
buf = gdf.geometry.buffer(0.5).area # element-wise .geo operations
web = gdf.to_crs("EPSG:3857") # reproject (CRS tracked through)
out = web.to_geopandas() # escape hatch -> real GeoDataFrame
```
## Placement question (opening this as a draft to discuss)
Per #791 you've been clear that the GeoPandas compatibility layer should be
prototyped in a **separate package** rather than added to core, and that a
monorepo package still adds maintenance surface. This draft puts it in the
monorepo as a standalone package to make the prototype concrete and easy to
look at — but the location is genuinely open. Happy to move it to a separate
repo, keep it here as an opt-in package, or shelve it, depending on your read.
Wanted the code in front of you before deciding.
## Scope (v1 "core slice")
- `from_geopandas()` + a lazy default context (no explicit `connect()`), and
`to_geopandas()`.
- `GeoDataFrame`: `__getitem__` (boolean-mask filter, column access, column
subset), `.geometry`, `.crs`, `.columns`, `.to_crs`, `len`.
- `Series` / `GeoSeries`: comparison/`& | ~` mask building;
`GeoSeries.buffer()`, `.centroid`, `.area`, `.length`.
Deferred to later slices: `sjoin` / `dissolve`, `__setitem__` (rebind),
reductions, broader `.geo` method coverage.
## Intentional differences from GeoPandas (documented in the README)
- **Lazy, not eager** — operations build a query; data materializes on
`to_geopandas()` / display.
- **No row index / alignment** — filters and (eventual) joins are
relational, not index-aligned.
- **Immutable under the hood** — "in-place" style operations return a new
frame.
- **Plotting / arbitrary `apply`** — use the `to_geopandas()` escape hatch.
The companion "Migrating from GeoPandas" cookbook (separate branch) is the
behavioral spec for these mappings.
## Tests
`pip install -e` + 9 tests comparing outputs to GeoPandas (filter, boolean
composition, buffer/area, centroid, to_crs, roundtrip, column types/subset).
ruff format + check clean.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]