Skip to content

feat: add GeoPandas geometry table support - #10536

Open
kirangadhave wants to merge 5 commits into
kg/geometry-fixture-corpusfrom
kg/geometry-contract-geopandas
Open

feat: add GeoPandas geometry table support#10536
kirangadhave wants to merge 5 commits into
kg/geometry-fixture-corpusfrom
kg/geometry-contract-geopandas

Conversation

@kirangadhave

@kirangadhave kirangadhave commented Aug 13, 2026

Copy link
Copy Markdown
Member

📝 Summary

Add geometry to 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

@vercel

vercel Bot commented Aug 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview Aug 19, 2026 7:30pm

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation dependencies bash-focus Area to focus on during release bug bash labels Aug 13, 2026
@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread marimo/_plugins/ui/_impl/tables/geometry.py
Comment thread marimo/_plugins/ui/_impl/tables/pandas_table.py Outdated
@kirangadhave
kirangadhave requested a balanced review from Copilot August 13, 2026 19:42
@kirangadhave
kirangadhave marked this pull request as ready for review August 13, 2026 19:42
@kirangadhave
kirangadhave force-pushed the kg/geometry-contract-geopandas branch from cefa592 to fe4b80e Compare August 13, 2026 19:43
@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for ./frontend

Status Category Percentage Covered / Total
🔵 Lines 78.78% 82092 / 104196
🔵 Statements 78.78% 82092 / 104196
🔵 Functions 71.67% 706 / 985
🔵 Branches 79.45% 4976 / 6263
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
frontend/src/components/data-table/columns.tsx 96.85% 74.66% 33.33% 96.85% 224-226, 294, 352, 480, 482, 484, 486, 488, 490, 510, 606-607, 635, 719
frontend/src/components/data-table/charts/chart-spec/types.ts 90.19% 50% 100% 90.19% 41-42, 71, 73, 75
frontend/src/components/data-table/column-formatting/feature.ts 90.18% 69.04% 100% 90.18% 162, 164, 182, 205, 214, 221-222, 232-234, 236-242, 244-246, 280
frontend/src/components/data-table/column-formatting/types.ts 100% 100% 100% 100%
frontend/src/components/data-table/column-summary/chart-spec-model.tsx 98.5% 77.77% 100% 98.5% 439-445, 841, 843-844
frontend/src/components/data-table/column-summary/column-summary.tsx 56.15% 0% 100% 56.15% 86-102, 107-134, 137-146, 148, 150-157, 160-163, 166-167
frontend/src/components/datasets/icons.tsx 90.47% 53.84% 100% 90.47% 50, 55, 66-67
frontend/src/core/codemirror/language/languages/sql/renderers.tsx 87.87% 33.33% 100% 87.87% 113, 118-120, 134, 144, 195-202, 227-230, 240-280, 305-307
frontend/src/core/kernel/messages.ts 100% 100% 100% 100%
frontend/src/plugins/impl/data-editor/glide-data-editor.tsx 68.95% 12.5% 0% 68.95% 117, 124-125, 165-169, 180-183, 189-193, 206-210, 236-272, 278-298, 304-307, 312-332, 340-371, 378-405, 427-428, 566, 574
frontend/src/plugins/impl/data-editor/glide-utils.ts 91.45% 36.84% 100% 91.45% 24, 26, 28, 38, 40, 43, 45, 48, 50-51
frontend/src/plugins/impl/data-frames/utils/operators.ts 99.36% 95.65% 100% 99.36% 175
frontend/src/plugins/impl/vega/utils.ts 100% 100% 100% 100%
Generated in workflow #20614 for commit fee6cd1 by the Vitest Coverage Report Action

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread marimo/_plugins/ui/_impl/table.py
Comment thread tests/_plugins/ui/_impl/tables/test_geometry.py Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 4 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread marimo/_plugins/ui/_impl/tables/pandas_table.py Outdated
Comment thread marimo/_plugins/ui/_impl/tables/pandas_table.py

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread marimo/_plugins/ui/_impl/tables/pandas_table.py
Comment thread marimo/_plugins/ui/_impl/tables/pandas_table.py
mscolnick
mscolnick previously approved these changes Aug 14, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bash-focus Area to focus on during release bug bash dependencies documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants