Introducing for Jupyter

Shan He
Published in
4 min readJun 25, 2019

-- is an advanced geospatial visualization tool open sourced by Uber’s Visualization team in 2018 and contributed to the Urban Computing Foundation earlier this year. At Uber, is the defacto tool for geospatial data analysis.

In order to help data scientists work more effectively, we integrated into many widely used data analysis platforms, now including Jupyter Notebook. Jupyter Notebook is a popular open source web application used to create and share documents that contain live code, equations, visualizations, and text, commonly used among data scientists to conduct data analysis and share results. At Uber, data scientists have utilized this integration to analyze multitudes of geospatial data collected through the app, in order to better understand how people use Uber, and how to improve their trip experience. Now, everyone can leverage within Jupyter Notebook.

We integrated as a Jupyter Widget. It loads inside a notebook cell, allowing users to quickly plot maps with simple python commands and interact with the UI to customize the visualization (Figure 1). It provides a seamless analysis workflow, combining data querying, transformation, analysis, and visualization — all inside Jupyter Notebook.

Figure 1. Using in Jupyter Notebook to visualize geospatial data

How to use the widget on Jupyter Notebook

You can find the complete user guide and demo notebooks in the repo documentation folder.

First, install keplergl with pip.

$ pip install keplergl

Launch Jupyter Notebook either on your local machine or on the server.

$ jupyter notebook

Load the widget with the command below, and an empty map will be loaded below the cell (Figure 2.). You can use the `height` parameter to define window size.

Figure 2. Load an empty map

Now, let’s add data to the map. Like the app, the widget supports CSV and GeoJSON. In addition, it also supports Pandas DataFrame and GeoPandas GeoDataFrame. For more on supported data formats, go to the Data Format section of the user guide. Call add_data To add data to map. Dataset is required to have a name. Name is the id of the dataset in config, and will be used to link layers and filters to it.

After the data is loaded into the map, you can use the side panel to edit the layers, filters and base map style just like how you would with (Figure 3).

Figure 3. Interact with to edit layers and filters

When you are happy with the final result, print out the current map configuration using .config and save it for later to be used as a template (Figure 4).

When calling keplergl.KeplerGl(), you can pass in config and data values to initialize a predefined map. Pay attention to the name of the data and dataId saved in layer and filter config. They need to match each other for the config to be applied. Read more about match config with data. also supports saving the map as an interactive HTML document with save_to_html. map data and config are saved to iPython widget state. This allows the notebook file to be rendered with rendered map. Unfortunately, widget state is not automatically saved when the kernel shuts down. Which means in order to load the map after restarting the kernel, you need to manually save notebook widget state before shutting down the kernel (Figure 5).

Figure 5. Save widget state to preserve map

That’s it! This is all you need to know to use inside Jupyter Notebook. You can submit bug and feature request using our GitHub template. Make sure to share your maps and notebooks built with widget on Twitter with #keplergl or tag @heshan_cheri.