How to Visualize Geospatial Data in Jupyter with Kepler.gl – A Step‑by‑Step Guide
This guide introduces Kepler.gl, Uber’s open‑source geospatial visualization library, shows how to install it in a Jupyter notebook, demonstrates creating maps from CSV, GeoJSON or DataFrame sources, customizing charts, extracting configurations, and exporting the result to an HTML file for easy sharing.
keplerglis an open‑source geospatial data visualization tool developed by Uber. It can be used directly inside Jupyter notebooks to create interactive maps.
Installation
Official documentation: https://docs.kepler.gl/docs/keplergl-jupyter
Install via pip: pip install keplergl If you are on macOS with Jupyter notebook version 5.3 or newer, you can skip the nbextension steps.
jupyter nbextension install --py --sys-prefix keplergl # can be skipped for notebook 5.3 and above
jupyter nbextension enable --py --sys-prefix keplergl # can be skipped for notebook 5.3 and aboveSimple Example
Running the following code creates an empty Kepler.gl window, confirming a successful installation.
from keplergl import KeplerGl
# Create a KeplerGl object
map_1 = KeplerGl(height=500)
# Display the map in the notebook
map_1Adding Data
Kepler.gl supports three data formats: csv, geojson, and DataFrame. The example below uses a DataFrame.
First, read the data with pandas:
import pandas as pd
df = pd.read_csv('rocket_launch_site_elevation_2019-10-27.csv')
df.head()Create another KeplerGl object and add the data using .add_data():
# Create a KeplerGl object
map_2 = KeplerGl(height=600)
# Activate the object in the notebook
map_2
# Add data
map_2.add_data(name='rocket', data=df)
# Display the map
map_2Customizing Charts
Unlike libraries such as pyecharts or matplotlib, Kepler.gl does not require extensive code for colors or chart types. All visual customizations can be performed interactively with the mouse in the UI.
Retrieving Configuration
The current map configuration, including UI interactions, can be obtained with the .config attribute.
map_2.configThe configuration can be reused for other maps:
# Create a new KeplerGl object with the previous configuration
map_3 = KeplerGl(height=600, config=map_2.config)
# Activate the object
map_3
# Add the same data
map_3.add_data(name='rocket', data=df)
# Display the map
map_3Exporting the Map
Use .save_to_html() to export the map to an HTML file. Parameters include: data: map data (defaults to current data if omitted) config: map configuration (defaults to current config if omitted) file_name: output file name, default
keplergl_map.html read_only: if True, the exported file is read‑only
map_3.save_to_html(file_name='kepler_example.html')Open the generated HTML file in a browser to start exploring your visualization.
Conclusion
Kepler.gl is an easy‑to‑use visualization tool that requires minimal coding for map configuration. Its graphical interface lets you create attractive geospatial visualizations quickly, making it a strong choice when you need to visualize geographic data in your projects.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
