feat: add GeoPandas geometry table support - #10536
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
All contributors have signed the CLA ✍️ ✅ |
d907dbd to
cefa592
Compare
There was a problem hiding this comment.
All reported issues were addressed
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
cefa592 to
fe4b80e
Compare
There was a problem hiding this comment.
Pull request overview
Adds GeoPandas geometry-column support across table serialization, statistics, schemas, and frontend presentation. This builds on #10516 and remains release-gated on later geometry-stack PRs.
Changes:
- Detects geometry dtypes while preserving GeoDataFrame subclasses and CRS.
- Serializes geometry cells as capped WKT and restricts unsupported operations.
- Adds geometry typing, icons, colors, and Vega handling across the frontend.
Reviewed changes
Copilot reviewed 40 out of 40 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
tests/_plugins/ui/_impl/tables/test_geometry.py |
Tests geometry detection and behavior. |
tests/_plugins/ui/_impl/tables/test_geometry_fixtures.py |
Updates GeoPandas expectations. |
tests/_messaging/test_enc_hook.py |
Tests standalone Shapely serialization. |
tests/_data/test_preview_column.py |
Tests chart suppression. |
tests/_data/test_charts.py |
Tests chart-builder fallback. |
packages/openapi/src/api.ts |
Adds generated geometry unions. |
packages/openapi/api.yaml |
Adds geometry to API schemas. |
marimo/_plugins/ui/_impl/tables/polars_table.py |
Uses shared semantic typing hook. |
marimo/_plugins/ui/_impl/tables/pandas_table.py |
Preserves and serializes GeoDataFrames. |
marimo/_plugins/ui/_impl/tables/narwhals_table.py |
Adds geometry semantics and guards. |
marimo/_plugins/ui/_impl/tables/ibis_table.py |
Uses shared semantic typing hook. |
marimo/_plugins/ui/_impl/tables/geometry.py |
Implements detection and formatting. |
marimo/_plugins/ui/_impl/table.py |
Suppresses charts and geometry sorting. |
marimo/_messaging/msgspec_encoder.py |
Serializes imported Shapely objects. |
marimo/_dependencies/dependencies.py |
Registers Shapely dependency detection. |
marimo/_data/preview_column.py |
Skips geometry previews. |
marimo/_data/models.py |
Adds the geometry data type. |
marimo/_data/charts.py |
Maps geometry to unknown charts. |
frontend/src/plugins/impl/vega/utils.ts |
Parses geometry as strings. |
frontend/src/plugins/impl/vega/__tests__/vega.test.ts |
Tests WKT parsing. |
frontend/src/plugins/impl/data-frames/utils/operators.ts |
Excludes geometry operators. |
frontend/src/plugins/impl/data-frames/utils/__tests__/operators.test.ts |
Tests operator exclusion. |
frontend/src/plugins/impl/data-frames/__tests__/schema.test.ts |
Tests geometry schema retention. |
frontend/src/plugins/impl/data-editor/glide-utils.ts |
Handles geometry headers. |
frontend/src/plugins/impl/data-editor/glide-data-editor.tsx |
Handles geometry defaults. |
frontend/src/plugins/impl/__tests__/DataEditorPlugin.test.ts |
Tests geometry validation. |
frontend/src/core/kernel/messages.ts |
Adds frontend geometry typing. |
frontend/src/core/codemirror/language/languages/sql/renderers.tsx |
Adds cyan geometry styling. |
frontend/src/core/codemirror/language/languages/sql/__tests__/renderers.test.tsx |
Tests geometry rendering. |
frontend/src/components/datasources/__tests__/components.test.tsx |
Tests geometry icons. |
frontend/src/components/datasets/icons.tsx |
Adds MapPin icon and color. |
frontend/src/components/datasets/__tests__/icons.test.ts |
Tests icon resolution. |
frontend/src/components/data-table/columns.tsx |
Disables geometry sort/filter UI. |
frontend/src/components/data-table/column-summary/column-summary.tsx |
Renders geometry statistics. |
frontend/src/components/data-table/column-summary/chart-spec-model.tsx |
Suppresses geometry charts. |
frontend/src/components/data-table/column-formatting/types.ts |
Removes geometry formats. |
frontend/src/components/data-table/column-formatting/feature.ts |
Leaves geometry values unchanged. |
frontend/src/components/data-table/charts/chart-spec/types.ts |
Maps geometry to nominal strings. |
frontend/src/components/data-table/charts/__tests__/schemas.test.ts |
Tests chart schema retention. |
frontend/src/components/data-table/__tests__/column_formatting.test.ts |
Tests absent format options. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
b05703c to
78c6b35
Compare
There was a problem hiding this comment.
All reported issues were addressed across 2 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
c1d4983 to
c35e294
Compare
c35e294 to
953daca
Compare
Geometry columns need a marimo-owned semantic type so table behavior does not depend on optional libraries being imported. Preserve GeoDataFrame metadata while exposing that contract through every table backend.
Geometry values cannot safely enter generic encoders, summaries, charts, or transforms. Gate Shapely-specific encoding and exclude geometry from host operations that assume scalar values.
Carry the geometry semantic type through the generated API and frontend consumers. Disable unsupported interactions while retaining useful display, schema, icon, and chart behavior.
Filtering geometry values is unsupported and pandas selection must retain GeoDataFrame subclasses. Enforce those constraints before downstream code loses geometry metadata or applies invalid comparisons.
GeoDataFrame metadata must survive the pandas 2.x mixed-object sorting path, while serialization continues to normalize non-string labels consistently. Use pandas-native sorting for this backend and align integration coverage with the established column-name contract.
953daca to
fee6cd1
Compare
📝 Summary
Add
geometryto marimo's closed data type list and detect GeoPandas geometry columns from their declared pandas dtype.Table operations preserve the GeoDataFrame subclass and CRS. Table cells use capped WKT and preserve null values.
Geometry supports total and null counts. It does not support sort, filter, search, top-k, unique-value, format, or inline-chart operations.
The frontend shows a cyan MapPin icon and sends WKT to Vega as strings. Ordinary table payloads do not change.
This PR is stacked on #10516 and is part of MO-6362.
Important
This PR must not ship in a marimo release until PRs 3-5 of the geometry stack merge.
Closes MO-7323