-
Notifications
You must be signed in to change notification settings - Fork 16.2k
feat(chart): support icons and text in the deck.gl Geojson visualization
#36201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat(chart): support icons and text in the deck.gl Geojson visualization
#36201
Conversation
Code Review Agent Run #b486f3Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
deck.gl Geojson visualization
|
Waouw !! Great !! Congratulation ! +1 !!! |
|
@DamianPendrak mind taking a look since it's deck.gl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds support for rendering GeoJSON points as text labels and/or icons in the deck.gl GeoJSON visualization. Previously, points could only be rendered as circles. The feature provides both a "basic" UI-driven configuration flow and an "advanced" JavaScript-driven flow for users who need more customization.
- Adds label rendering with configurable property name, color, size, and units
- Adds icon rendering with configurable URL, size, and units
- Provides JavaScript mode for advanced per-point customization of labels and icons
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/controls.ts |
Adds BLACK_COLOR constant for default label color |
superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/Shared_DeckGL.tsx |
Exports jsFunctionControl for use in GeoJSON control panel |
superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Geojson/controlPanel.ts |
Adds UI controls for enabling and configuring labels and icons in both basic and JavaScript modes |
superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Geojson/Geojson.tsx |
Implements label and icon rendering logic, including helper functions to compute options from form data or JavaScript output |
superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Geojson/Geojson.test.ts |
Adds unit tests for the new helper functions that compute label and icon options |
superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Geojson/controlPanel.ts
Show resolved
Hide resolved
| return []; | ||
| } | ||
|
|
||
| export const PRIMARY_COLOR = { r: 0, g: 122, b: 135, a: 1 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@msyavuz @mistercrunch if anyone's keeping a punch list somewhere of themable things, this PRIMARY_COLOR setting could be a good one to match with the theme's primary color.
rusackas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks SO cool!
The only thing I'd like to request right now (to prevent XSS attacks) is to put the Javascript forms and the checkboxes to reveal them behind the ENABLE_JAVASCRIPT_CONTROLS feature flag by adding isFeatureEnabled(FeatureFlag.ENABLE_JAVASCRIPT_CONTROLS) where relevant. A lot of orgs have that flag turned off for (very good) safety reasons.
Otherwise, this is complete awesomeness!
| description: t( | ||
| 'The image URL of the icon to display for GeoJSON points. ' + | ||
| 'Note that the image URL must conform to the content ' + | ||
| 'security policy (CSP) in order to load correctly.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appreciate the CSP note! Very important :D
|
🎪 Showtime deployed environment on GHA for c79c175 • Environment: http://34.213.178.163:8080 (admin/admin) |
d8c00e8 to
c79c175
Compare
@rusackas Thank you, and valid security concern! I made this change in 740b3c2. |
SUMMARY
The
deck.gl Geojsonvisualization allows users to visualize point, line, and polygon geometries on maps using the GeoJSON specification. Currently, users can only render points as circles, however, deck.gl'sGeoJsonLayersupports rendering points as circles, icons, and/or text according to the GeoJsonLayer documentation.This pull request extends the existing functionality, allowing users to additionally render points as labels and/or icons.
Approach
To support both basic and advanced use cases, we implemented two configuration flows for adding labels and/or icons:
Rationale
deck.gl's
GeoJsonLayersupports many options for labels and icons, but exposing all of them in the UI would lead to a cluttered experience. The approach taken here avoids cluttering the UI while flexibly supporting both basic and advanced use cases.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Text/Label Support Demo
text-feature.mp4
Icon Support Demo
icon-feature.mp4
TESTING INSTRUCTIONS
Create a GeoJSON dataset.
Click here for the sample dataset from the demo
You can use this query to create a dataset in Superset using the SQL Lab interface:
Create a
deck.gl Geojsonchart/visualization using the dataset created in step 1.Under the
Querysection, fill the requiredGeoJson Columnfield (if using the sample dataset, selectJSON).Under the
GeoJson Settingssection, configure label and/or icon settings as was shown in the demo videos.Notes
ENABLE_JAVASCRIPT_CONTROLSfeature flag is enabled.https://static.thenounproject.comto theconnect-srcdirective in the CSP found insuperset/config.py. If you simply want to test icons without modifying the CSP, you can try this sample image URL (it is hosted on cartocdn, which is included in the default CSP).ADDITIONAL INFORMATION
ENABLE_JAVASCRIPT_CONTROLS