Skip to content

feat(deckgl): add support for OpenStreetMap as our new default and make "tile-providers" more configurable #33603

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

plavacquery
Copy link

@plavacquery plavacquery commented May 28, 2025

SUMMARY

This PR introduces support for OpenStreetMap as the tile provider behind deckgl charts. It also changes the default tile-provider to be OpenStreetMap, since Mapbox isn't as open and requires configuration + an API key. This PR makes tile-providers configurable, so it's possible for those who have an API key and prefer Mapbox to match the default as of before-this-PR.

Changing defaults here is a "breaking change" in the sense that the default is changing, but you can reproduce the previous behavior with a bit of documented configuration.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

image

TESTING INSTRUCTIONS

In config.py set the following

DECKGL_BASE_MAP = [
     ['tile://https://c.tile.openstreetmap.org/{z}/{x}/{y}.png', 'OpenStreetMap' ],
]

ENABLE_CORS = True
CORS_OPTIONS: dict[Any, Any] = {
    "origins": [
        "https://c.tile.openstreetmap.org",
    ]
}

And in TALISMAN_DEV_CONF
add "https://c.tile.openstreetmap.org" to 'connect-src' array

ADDITIONAL INFORMATION

  • Has associated issue :Add tile layer (XYZ) support in deck.gl maps #27475
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

Copy link

korbit-ai bot commented May 28, 2025

Korbit doesn't automatically review large (3000+ lines changed) pull requests such as this one. If you want me to review anyway, use /korbit-review.

@github-actions github-actions bot added doc Namespace | Anything related to documentation plugins dependencies:npm packages labels May 28, 2025
@dosubot dosubot bot added the viz:charts:deck.gl Related to deck.gl charts label May 28, 2025
@plavacquery
Copy link
Author

plavacquery commented May 28, 2025

Coming from MR : #32867 (Inadvertently closed by failed rebase)

@mistercrunch I have implemented what you asking for about OSM map with deckgl.
Map examples are also set with OSM.

Copy link
Contributor

@mistercrunch Processing your ephemeral environment request here. Action: up. More information on how to use or configure ephemeral environments

@mistercrunch
Copy link
Member

Nice! firing up CI and an ephemeral env. Really excited that deckgl-powered visualization will now work out of the [map]box!!!

@@ -47,6 +47,7 @@ There's a migration added that can potentially affect a significant number of ex
- [30284](https://github.com/apache/superset/pull/30284) Deprecated GLOBAL_ASYNC_QUERIES_REDIS_CONFIG in favor of the new GLOBAL_ASYNC_QUERIES_CACHE_BACKEND configuration. To leverage Redis Sentinel, set CACHE_TYPE to RedisSentinelCache, or use RedisCache for standalone Redis
- [31961](https://github.com/apache/superset/pull/31961) Upgraded React from version 16.13.1 to 17.0.2. If you are using custom frontend extensions or plugins, you may need to update them to be compatible with React 17.
- [31260](https://github.com/apache/superset/pull/31260) Docker images now use `uv pip install` instead of `pip install` to manage the python envrionment. Most docker-based deployments will be affected, whether you derive one of the published images, or have custom bootstrap script that install python libraries (drivers)
- [33603](https://github.com/apache/superset/pull/33603) OpenStreetView has been promoted as the new default for Deck.gl visualization since it can be enabled by default without requiring an API key. If you have Mapbox set up and want to disable OpenStreeView in your environment, please follow the steps documented here [https://superset.apache.org/docs/configuration/map-tiles].
Copy link
Member

Choose a reason for hiding this comment

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

Nice! A+ for change-management here!

Copy link

codecov bot commented May 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.95%. Comparing base (76d897e) to head (b47fb9f).
Report is 1959 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #33603       +/-   ##
===========================================
+ Coverage   60.48%   72.95%   +12.47%     
===========================================
  Files        1931      558     -1373     
  Lines       76236    40283    -35953     
  Branches     8568     4222     -4346     
===========================================
- Hits        46114    29390    -16724     
+ Misses      28017     9802    -18215     
+ Partials     2105     1091     -1014     
Flag Coverage Δ
hive 47.22% <100.00%> (-1.94%) ⬇️
javascript ?
mysql 71.94% <100.00%> (?)
postgres 72.01% <100.00%> (?)
presto 50.97% <100.00%> (-2.83%) ⬇️
python 72.92% <100.00%> (+9.41%) ⬆️
sqlite 71.51% <100.00%> (?)
unit 100.00% <ø> (+42.36%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@mistercrunch Ephemeral environment spinning up at http://44.248.152.230:8080. Credentials are 'admin'/'admin'. Please allow several minutes for bootstrapping and startup.

@mistercrunch
Copy link
Member

The ephemeral environment doesn't seem to load openstreetmap out of the box (?)

@mistercrunch
Copy link
Member

Screenshot 2025-05-30 at 2 38 58 PM

Copy link
Contributor

github-actions bot commented Jun 4, 2025

@mistercrunch Processing your ephemeral environment request here. Action: up. More information on how to use or configure ephemeral environments

Copy link
Contributor

github-actions bot commented Jun 4, 2025

@ Ephemeral environment creation failed. Please check the Actions logs for details.

@@ -119,6 +119,8 @@ flask-caching==2.3.1
# via apache-superset (pyproject.toml)
flask-compress==1.17
# via apache-superset (pyproject.toml)
flask-cors==4.0.2
Copy link
Member

@mistercrunch mistercrunch Jun 6, 2025

Choose a reason for hiding this comment

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

oh, wondering if you added this manually? This is not self-evident, but this file is supposed to be compiled by uv pip compile via the script at https://github.com/apache/superset/blob/master/scripts/uv-pip-compile.sh . I think the proper way is to alter https://github.com/apache/superset/blob/master/requirements/base.in#L19 to add a line referencing to .[cors], and then running the script...

Copy link
Member

Choose a reason for hiding this comment

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

I'm trying to clarify how it should be done here -> #33714

In you case I think adding a line for .[cors] in base.in makes most sense. Either that or promoting the one dep in cors to the core set of dependencies in pyproject.toml

Copy link
Contributor

@mistercrunch Processing your ephemeral environment request here. Action: up. More information on how to use or configure ephemeral environments

Copy link
Contributor

@mistercrunch Ephemeral environment spinning up at http://44.246.245.101:8080. Credentials are 'admin'/'admin'. Please allow several minutes for bootstrapping and startup.

@mistercrunch
Copy link
Member

NICE!
Screenshot 2025-06-12 at 4 14 28 PM

* @param v
*/
export default function validateMapboxStylesUrl(v: unknown) {
if (
typeof v === 'string' &&
v.trim().length > 0 &&
v.trim().startsWith('mapbox://styles/')
(v.trim().startsWith('mapbox://styles/') ||
Copy link
Member

Choose a reason for hiding this comment

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

How about trim() once above the if block?

"@deck.gl/core": "^9.0.37",
"@deck.gl/layers": "^9.0.38",
"@deck.gl/react": "^9.1.4",
"@deck.gl/aggregation-layers": "^9.1.9",
Copy link
Member

Choose a reason for hiding this comment

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

nice side-win to upgrade to a newer deck.gl!

Copy link
Member

Choose a reason for hiding this comment

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

wow btw looks like this ends up affecting 20k LoC in pacakge-lock.json (!?) curious on doing a sanity check on what's happening in there.... GitHub won't let me expand and don't have time to pull the branch to diff it, but would be great if you can validate/explain why changing a few lines here results in so much package-lock changes (?)

Screenshot 2025-06-12 at 4 28 34 PM

Copy link
Author

@plavacquery plavacquery Jun 18, 2025

Choose a reason for hiding this comment

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

Indeed i pushed package-lock.json after making an "npm i --force", should be fix now

Copy link
Member

Choose a reason for hiding this comment

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

looks much better now!

v.trim().startsWith('mapbox://styles/')
(v.trim().startsWith('mapbox://styles/') ||
v.trim().startsWith('tile://http') ||
v.trim().includes('osm') ||
Copy link
Member

@mistercrunch mistercrunch Jun 12, 2025

Choose a reason for hiding this comment

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

this seems a bit dangerous, seems startswith https://tile.osm or https://tile.openstreetmap might be safer. There's probably a fancy one-liner-type expression like allowedPrefix.some(s => trimmed.startswith(s)))

Copy link
Member

@mistercrunch mistercrunch left a comment

Choose a reason for hiding this comment

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

Added a few comments but super bullish on pushing this through! Amazing work!

QQ, would it be easy to add a few more grayscale, perhaps a dark and light more in there? Curious what tiles are provided as part of OSM and if it's easy to match the kind of diversity that we have on the Mapbox side of the house...

@imkonsowa
Copy link

Thank you guys or the great work here, are you going to release this soon? I have the same need of configuring map tiles server and it would be great to have it with superset!

@mistercrunch
Copy link
Member

are you going to release this soon?

Happy to merge once the few minor comments are addressed. Likely to first hit in 6.0, which we'll cut and stabilize as soon as 5.0 is released, and the large Theming-related branch is merged.

@plavacquery
Copy link
Author

Added a few comments but super bullish on pushing this through! Amazing work!

QQ, would it be easy to add a few more grayscale, perhaps a dark and light more in there? Curious what tiles are provided as part of OSM and if it's easy to match the kind of diversity that we have on the Mapbox side of the house...

I tried to find new ones but unfortunately there are only availables when connecting on their website

Copy link
Contributor

@mistercrunch Processing your ephemeral environment request here. Action: up. More information on how to use or configure ephemeral environments

Copy link
Member

@mistercrunch mistercrunch left a comment

Choose a reason for hiding this comment

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

LGTM! I fired up a fresh ephemeral env to make sure things look good and OSM loads out-of-the-box. Will do some basic checks there before merging.

Amazing contribution btw ❤️ ❤️ ❤️

@mistercrunch mistercrunch changed the title feat(deckgl): make map tiles configurable feat(deckgl): add support for OpenStreetMap as our new default and make "tile-providers" more configurable Jun 23, 2025
@mistercrunch
Copy link
Member

Took the freedom to update the PR title as it'll become the commit message in master as we squash-merge it

@mistercrunch mistercrunch added the risk:breaking-change Issues or PRs that will introduce breaking changes label Jun 23, 2025
@mistercrunch
Copy link
Member

Almost there! Though it looks like there's a unit test failing here -> https://github.com/apache/superset/actions/runs/15833515890/job/44633495868?pr=33603

Copy link
Contributor

@mistercrunch Ephemeral environment spinning up at http://35.89.168.235:8080. Credentials are 'admin'/'admin'. Please allow several minutes for bootstrapping and startup.

@mistercrunch
Copy link
Member

Works! Interestingly my localstorage is in dark mode, which doesn't look perfect, but still a great step forward versus not-tiles-at-all.

Screenshot 2025-06-23 at 1 24 49 PM

@mistercrunch
Copy link
Member

I tried to find new ones but unfortunately there are only availables when connecting on their website

GPT seems to think there are some free/open options here -> https://chatgpt.com/share/6859b984-7d54-8010-8b86-10d483bc4fa2

Looks a bit rough and out-of-place in dark mode ->
Screenshot 2025-06-23 at 1 31 38 PM

@mistercrunch
Copy link
Member

mistercrunch commented Jun 23, 2025

For context Theming + dark mode just landed in master, and we may have to think how we'll support visualization theming to align with this across the board. Seems most core visualization are now able to adapt nicely using alpha transparency, but for something like those deck.gl visualization, we may want to have the chart define options like "Map Style for Light Mode" and another "Map Style for Dark Mode", where the person saving the chart would have the option to specify both, and we'd have a bit of logic checking if the user is in dark mode or not and apply the right tiles based on that.

It's not a requirement to sort this out prior to merging this PR, but would be nice to eventually have that option.

@mistercrunch
Copy link
Member

About the conflict on package-lock, we get that all the time. Usually you just want to git checkout master superset-frontend/package-lock.json and then re-run npm i, commit and push

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies:npm doc Namespace | Anything related to documentation packages plugins risk:breaking-change Issues or PRs that will introduce breaking changes size/L testenv-up viz:charts:deck.gl Related to deck.gl charts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants