Repository navigation
feat(deckgl): add a Vector Tiles (MVT) chart - #46649
Open
sohil-chhabra wants to merge 26 commits into
Open
sohil-chhabra wants to merge 26 commits into
sohil-chhabra wants to merge 26 commits into
Conversation
sohil-chhabra
marked this pull request as ready for review
November 28, 2026 00:26
| // SQL query. The shared tooltip code reads `tooltip_contents`, so they are | ||
| // handed over only here, in the browser. | ||
| const tooltipContent = createTooltipContent( | ||
| { ...formData, tooltip_contents: tooltipProperties }, |
Contributor
There was a problem hiding this comment.
Suggestion: When a selected tile field contains 0 or false, the shared tooltip extractor treats it as missing, so the field-based tooltip omits it.
Assessment: 🟠 Major · 🔁 Occurrence: Sometimes · 🏷️ Falsy zero check
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** superset-frontend/plugins/preset-chart-deckgl/src/layers/VectorTile/VectorTile.tsx
**Line:** 111:111
**Comment:**
*Falsy Zero Check: When a selected tile field contains `0` or `false`, the shared tooltip extractor treats it as missing, so the field-based tooltip omits it.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
Contributor
This branch has not been deployed
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
Superset’s map charts can’t read the native geometry formats that spatial databases use (Ex: WKB). This prompts the user to make lat/lon or geojson columns.
The charts also send every row to the browser once which is a disadvantage for large geospatial layers.
Hence, this PR adds a deck.gl Vector tiles chart that draws vector tiles from any tile server.
Discussion: #43001 (comment)
A few decisions taken while implementing this feature:
tooltip_properties): The backend addstooltip_contentsto the SQL query, which would break for tile-only properties since the users are allowed to add TileJSON URL from which we retrieve the properties/fields. Without TileJSON URL, the dataset columns are listed@maplibre/maplibre-gl-style-spec. This dependency addition and conversion was intended because a very useful followup to this MVP is to let users add/paste their own Maplibre expressions.Here's an AI assisted summary of the changes. However, I've reviewed it and agree with it. :
deck_vector_tile(layers/VectorTile/), registered in the deck.glpreset. It renders a deck.gl
MVTLayer, decoding tiles on the main thread becausethe default worker loads from a CDN that Superset's CSP blocks.
layerSettings.ts): normalises form data. The tile URL must contain{z},{x}and{y}; zoom is clamped to 0-24 and swapped if reversedstyling.ts): each colour mode is compiled once into a MapLibreexpression with
@maplibre/maplibre-gl-style-spec(new dependency) and evaluatedper feature.
CategoricalColorScale, cached for eachchart and palette so colours stay stable as new tiles load. The cache is rebuilt
when a dashboard changes its custom label colours. Like the other categorical
deck.gl charts, these colours are fully opaque.
to-number,which would otherwise turn them into 0 or 1.
tileJson.ts,TilePropertyControl.tsx): fetches the document (onlyhttp/httpsURLs), caching one request per URL, and lists the properties of the source layer. Thebreakpoint picker lists only numeric properties. If the fetch fails, the control shows a warning and falls back to the dataset's columns.
tooltip_properties. Properties are copied to the top level, so templates can use{{ name }}.legend.ts): reads the colour property straight from the binary data ofthe tiles on screen. Points copied into a neighbouring tile's buffer are counted once. Hidden in fixed-colour mode.
layers/index.ts, so it can be added as a layer.createTooltipContent's fallback may returnnull. That's aone-line type change.
map-tiles.mdx, and a CSP note insecurity.mdx.buildQueryand the control panel, plus render tests for the layer.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Screen.Recording.2026-11-27.at.2.57.52.PM.mov
TESTING INSTRUCTIONS
1. Start a tile server with demo data (PostGIS + Martin, 50,000 points around Toronto).
docker-compose.yml:Seed data:
Details
seed.sql: 50,000 random places around TorontoCheck that http://localhost:3000/places returns TileJSON listing
category,id,name,ratingandvisitors.2. Allow the tile server in the CSP. In
superset_config.py, add"http://localhost:3000"toconnect-srcinTALISMAN_DEV_CONFIG(and inTALISMAN_CONFIGif not running in debug mode). Restart Superset.3. Create the chart. Choose the dataset created earlier, then the
deck.gl Vector Tiles chart, and set:
http://localhost:3000/places/{z}/{x}/{y}http://localhost:3000/placesplaces-79.38, latitude43.70, zoom10Points should appear around Toronto.
4. Try each feature:
{y}. The control shows an error and no layer is drawn.category: five colours appear, and the legendlists the five categories. Pan and zoom: each category keeps its colour on newly
loaded tiles. Changing the palette repaints the points and the legend.
name: the legend shows 10 rows plus "+ N more".id,ratingandvisitors. Pickratingand add 0-2 for red and 2.5-5 for blue. Ratings between2 and 2.5 use the default colour. The legend shows both ranges, and Legend Format
changes how they're displayed.
layerName.Choosing tooltip properties limits the list. A template such as
{{ name }} ({{ rating }})also works.http://localhost:3001/places. Thepickers show a warning and list the dataset's columns instead.
5. Unit tests:
ADDITIONAL INFORMATION
Known limitations
Points near tile edges are counted once. Lines and polygons that span several tiles
are counted once per tile, because the tile server cuts them at tile edges. This only
changes the order of the legend rows and doesn't changes which categories appear.
but Multiple Layers doesn't show per-layer legends.
Follow-ups/Stretch goals/Future
other categorical deck.gl charts.