Search code examples
pythonkepler.gl

How to set a custom mapbox token for Kepler in python/jupyter notebook?


My kepler maps stopped rendering in Jupyter notebooks, and I suspect it's because I ran out of requests for the free public mapbox token - I think so because if I try to use mapbox tiles from folium I get an empty map, but if I use OSM tiles everything works fine. I've also tried every possible solution from https://github.com/keplergl/kepler.gl/issues/583

I've tried googling this and digging into the source code, but all the references to the mapbox token I could find are in the .js files, and I'm not really familiar with Javascript

The code is just this, the commented line is approximately what I'm looking for

from keplergl import KeplerGl
map_1 = KeplerGl()
#map_1 = KeplerGl(mapbox_api_token = some_token)

Solution

  • You can use the Add Map Style option to add the custom token and add a custom base map. When you save the map as a html on Jupyter, it retains the token and loads the custom base map.

    Add Map Style Button