To visualize geographic data with superset you will need to get the MapBox token first and then apply that MapBox token with Superset configuration to consume it.
Please visit https://www.mapbox.com/ to request the MapBox token as needed.
Update your shell configuration to support Superset:
What you need:
- Superset Home
- If you have installed from pip/pip3 get the site-packages
- If you have installed from GitHub clone, use the GitHub clone home
- Superset Config file
- Create a file name superset_config.py and place it into your $HOME/.superset/ folder
- Python path includes superset config location with python binary
Update following into your .bash_profile or .zshrc:
export SUPERSET_HOME=/Users/avkashchauhan/anaconda3/lib/python3.7/site-packages/superset
export SUPERSET_CONFIG_PATH=$HOME/.superset/superset_config.py
export PYTHONPATH=/Users/avkashchauhan/anaconda3/bin/python:/Users/avkashchauhan/.superset:$PYTHONPATH
Minimal superset_config.py configuration:
#---------------------------------------------------------
# Superset specific config
#---------------------------------------------------------
ROW_LIMIT = 50000
SQLALCHEMY_DATABASE_URI = 'sqlite:////Users/avkashchauhan/.superset/superset.db'
MAPBOX_API_KEY = 'YOUR_TOKEN_HERE'
Start your superset instance:
$ superset run -p 8080 –with-threads –reload –debugger
Please verify the logs to make sure superset_config.py was loaded and read without any error. The successful logs will look like as below:
Loaded your LOCAL configuration at [/Users/avkashchauhan/.superset/superset_config.py]
If there are errors you will get an error (or more) just after the above line similar to as below:
ERROR:root:Failed to import config for SUPERSET_CONFIG_PATH=/Users/avkashchauhan/.superset/superset_config.py
IF your Sqlite instance is not configured correctly you will get error as below:
2019-11-06 14:25:51,074:ERROR:flask_appbuilder.security.sqla.manager:DB Creation and initialization failed: (sqlite3.OperationalError) unable to open database file
(Background on this error at: http://sqlalche.me/e/e3q8)
The successful superset_config.py loading will return with no error as below:
Loaded your LOCAL configuration at [/Users/avkashchauhan/.superset/superset_config.py]
2019-11-06 17:33:16,588:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'>
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: off
2019-11-06 17:33:17,294:INFO:werkzeug: * Running on http://127.0.0.1:8080/ (Press CTRL+C to quit)
2019-11-06 17:33:17,306:INFO:werkzeug: * Restarting with fsevents reloader
Loaded your LOCAL configuration at [/Users/avkashchauhan/.superset/superset_config.py]
2019-11-06 17:33:18,644:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'>
2019-11-06 17:33:19,345:WARNING:werkzeug: * Debugger is active!
2019-11-06 17:33:19,353:INFO:werkzeug: * Debugger PIN: 134-113-136
Now if you visualize any dataset with geographic columns i.e. longitude and latitude the Superset will be able to show the data properly as below:

That’s all for now.
@avkashchauhan