rolies106 commented on issue #30307:
URL: https://github.com/apache/superset/issues/30307#issuecomment-2862044923

   For anyone that want to move to Carto or MapLibre can try this hack while 
waiting for the official release, I'm using 4.1.2 tag and modify this script.
   
   go to 
`superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/Shared_DeckGL.jsx`
 and edit this section:
   
   ```javascript
   export const mapboxStyle = {
     name: 'mapbox_style',
     config: {
       type: 'SelectControl',
       label: t('Map Style'),
       clearable: false,
       renderTrigger: true,
       freeForm: true,
       // validators: [validateMapboxStylesUrl], // Comment out this and dont 
forget to remove it from the import part at the beginning of this file
       choices: [
         [
           'https://basemaps.cartocdn.com/gl/positron-gl-style/style.json',
           'Carto Light',
         ], // Add this
         [
           'https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json',
           'Carto Dark',
         ], // Add this
         ['https://demotiles.maplibre.org/style.json', 'MapLibre OSM'], // Add 
this
         ['mapbox://styles/mapbox/streets-v9', t('Streets')],
         ['mapbox://styles/mapbox/dark-v9', t('Dark')],
         ['mapbox://styles/mapbox/light-v9', t('Light')],
         ['mapbox://styles/mapbox/satellite-streets-v9', t('Satellite 
Streets')],
         ['mapbox://styles/mapbox/satellite-v9', t('Satellite')],
         ['mapbox://styles/mapbox/outdoors-v9', t('Outdoors')],
       ],
       default: 
'https://basemaps.cartocdn.com/gl/positron-gl-style/style.json', // Change 
default value
       description: t(
         'Base layer map style. See Mapbox documentation: %s',
         'https://docs.mapbox.com/help/glossary/style-url/',
       ),
     },
   };
   ```
   
   go to superset/config.py to allow the new style by edit the TALISMAN_CONFIG 
and TALISMAN_DEV_CONFIG:
   
   ```python
   TALISMAN_CONFIG = {
       "content_security_policy": {
           "base-uri": ["'self'"],
           "default-src": ["'self'"],
           "img-src": [
               "'self'",
               "blob:",
               "data:",
               "https://apachesuperset.gateway.scarf.sh";,
               "https://static.scarf.sh/";,
               # "https://avatars.slack-edge.com";, # Uncomment when 
SLACK_ENABLE_AVATARS is True
           ],
           "worker-src": ["'self'", "blob:"],
           "connect-src": [
               "'self'",
               "https://api.mapbox.com";,
               "https://events.mapbox.com";,
               "https://basemaps.cartocdn.com";, // Add this line
               "https://demotiles.maplibre.org";, // Add this line
               "https://*.basemaps.cartocdn.com";, // Add this line
           ],
           "object-src": "'none'",
           "style-src": [
               "'self'",
               "'unsafe-inline'",
           ],
           "script-src": ["'self'", "'strict-dynamic'"],
       },
       "content_security_policy_nonce_in": ["script-src"],
       "force_https": False,
       "session_cookie_secure": False,
   }
   ```
   
   Inside `superset-frontend` run:
   - `npm install`
   - `npm run build`
   
   In the parent folder run build docker again:
   - `docker compose up -d --build`
   
   Edit the map style using Carto or MapLibre, and this is the preview when I'm 
using Carto Light Style
   
![Image](https://github.com/user-attachments/assets/66c5f050-cb68-4073-bc47-b781aa9e345c)
   
   I hope this can help someone, since I've been working on this for three days.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to