Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

2.2 KB
Raw Blame

Save and Export Map

When you click in the map and change settings, config is saved to widget state. Closing the notebook and reopening it will reload the current map. However, you need to manually select Widgets > Save Notebook Widget State before shutting down the kernel to make sure it will be reloaded.

Save Widget State

.save_to_html()

Export the map to a standalone HTML file.

Parameters

  • file_name: optional The HTML file name, default is keplergl_map.html.
  • data: optional A data dictionary {"name": data}. If not provided, will use current map data.
  • config: optional Map config dictionary. If not provided, will use current map config.
  • read_only: optional If True, hide side panel to disable map customization.
  • center_map: optional If True, fit map bounds to the data (default: True).
  • mapbox_token: optional Mapbox access token. Required for Mapbox basemap styles (e.g. "Dark", "Muted Light"). Leave empty for free MapLibre styles.
  • json_encoder: optional Fallback function passed as default when JSON-serializing GeoDataFrame data. Defaults to str so that datetime and other non-native JSON types are converted automatically. Pass None to disable (will raise on non-serializable types).
  • app_name: optional Application name shown in the side panel header and used as HTML <title>. If None, uses the value set at widget creation (default "kepler.gl").
  • theme: optional UI theme for the kepler.gl component ("light", "dark", "base", or ""). If None, uses the value set at widget creation.

Examples

# this will save current map
map_1.save_to_html(file_name='first_map.html')

# this will save map with provided data and config
map_1.save_to_html(data={'data_1': df}, config=config, file_name='first_map.html')

# this will save map with the interaction panel disabled
map_1.save_to_html(file_name='first_map.html', read_only=True)

# this will save map with a custom theme and app name
map_1.save_to_html(file_name='first_map.html', theme='light', app_name='My Map App')