Repository navigation
feat: enable spatial (map) support in the Vega-Lite writer - #12
Merged
Merged
Conversation
Add the crate's spatial feature so DRAW spatial map layers render through VegaLiteWriter instead of raising "Spatial visualization requires the 'spatial' feature to be enabled". Geometry columns (WKB) and the built-in ggsql:world dataset work out of the box with the default projection; named map projections (e.g. PROJECT TO mercator) and ST_* SQL functions additionally require the DuckDB spatial extension. Binary size impact is negligible (+~134 KB, 0.22%): the feature only pulls in the pure-Rust geozero crate (wkb/wkt/geojson), no native dependencies.
The ggsql crate only issues LOAD spatial (never INSTALL), which fails on machines without the extension binary cached under ~/.duckdb/extensions. CI runners start clean, so all TestSpatial tests failed on Linux/macOS and the download attempt hung the Windows test step indefinitely. Also add a 10-minute timeout to the test step to bound future hangs.
Spatial layers always need DuckDB's spatial extension at runtime (the reader issues LOAD spatial and computes extents via ST_ functions), not just named projections and ST_* calls. The previous wording claimed WKB columns and ggsql:world worked with no extension present, which only appeared true on machines where the extension was already cached.
cpsievert
marked this pull request as ready for review
October 13, 2026 17:31
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
Enables the ggsql crate's
spatialcargo feature soDRAW spatialmap layers render through the Vega-Lite writer. Today the wheel parses and validates spatial queries, but rendering fails withOutput generation error: Spatial visualization requires the 'spatial' feature to be enabled— after this change, maps render end to end, including through therender_chart()→ Altair → browser-widget path.Runtime requirement: DuckDB spatial extension
All
DRAW spatialqueries need DuckDB'sspatialextension at runtime — the reader issuesLOAD spatialautomatically (extent computation usesST_functions) but neverINSTALLit. So users must runINSTALL spatialonce per machine (e.g. viaDuckDBReader.execute_sql()); the ~59 MB download is cached per DuckDB version/platform under~/.duckdb/extensions. Without it, spatial queries fail with a clear SQL error pointing atINSTALL spatial.With the extension present, verified working:
ggsql:worlddataset (identity projection, with graticule)PROJECT TO mercator,equal_earth, …) via server-sideST_TransformspatiallayerBinary size impact: negligible
Same crate, same release profile, only the feature toggled: 60,737,888 → 60,871,744 bytes (+134 KB, +0.22%). The feature pulls in only the pure-Rust
geozerocrate (with-wkb/with-wkt/with-geojson) — no native dependencies (no PROJ/GEOS).Note:
ggsql-rhas the same feature list (plusodbc); enabling spatial there is an identical one-line change if parity is wanted, but is out of scope here.Verification
Tests:
uv run pytest tests/— newTestSpatialclass covers Vega-Lite rendering ofDRAW spatial(basic and choropleth) plus therender_chart()Altair round-trip. The class fixtureINSTALLs the extension (skips when offline); a 10-minute timeout on the CI test step bounds download hangs. Rust checks:cargo fmt -- --checkandcargo clippy -- -D warningsare clean.