The world’s leading publication for data science, AI, and ML professionals.

4 Must-have JupyterLab Extensions for Geospatial Data science

Essential JupyterLab extensions for GIS and Interactive Geospatial data.

Photo by Lucas Ludwig on Unsplash
Photo by Lucas Ludwig on Unsplash

JupyterLab is, without doubt, one of the best tools for doing Data Science. It is designed to be extensible and customisable, and in fact, there are a lot of extensions available.

As a geospatial data scientist, I was thinking about some of the JupyterLab extensions I often use after a fresh installation of Anaconda Environment. And I realise I missed some of those extensions and thought about their importance in my JupyterLab experience.

In this article, I am going to share four favourite and essential JupyterLab extensions for doing Spatial data science with JupyterLab. These are specific tools for rendering maps or Geospatial data inside JupyterLab.

1. GeoJSON-extension

The GeoSJON extension enables you to plot Geosjon data on the fly inside Jupyter lab quickly. No Need to read the data or Visualise it with Other desktop software.

In this example, We are plotting a JSON like data with Geometry right in JupyterLab cell.

Plot GeoJSON data directly in JupyterLab - Image by the author.
Plot GeoJSON data directly in JupyterLab – Image by the author.

It also enables you to render Geosjon file and Visualise it right inside Jupyter Notebook. GeoJSON-extension creates a separate output and comes with loaded base maps from Openstreetmap. How convenient is that?💪 Just bring your data as Geosjon file and double click on it.

GeoJSON output view - Image by the author.
GeoJSON output view – Image by the author.

Using GeoJSON-extension is a quick and convenient way to visualise geospatial data without reading it in memory, using python libraries like Geopandas. To enable GeoJSON-extension, you can run this command on Conda terminal:

jupyter labextension install @jupyterlab/geojson-extension

Visit the GeoJSON-extension repository for further information.

@jupyterlab/geojson-extension


Jupyter Matplotlib – Ipympl

I love using Geopandas and Matplotlib for creating non-interactive geospatial data visualisation. However, I recently found out that you can extend matplotlib interactive plots with Jupyter Matplotlib extension – Ipympl. Since then, it is my go tool for quick interactive geospatial data visualisation with Geopandas.

The following example shows the interactive functionality for Jupyter Matplotlib extension. You can create Geopandas plots as usual, and you only need to call the Jupyter magic command:%matplotlib widget .

Interactive Geopandas plot with Ipympl - Image by the author.
Interactive Geopandas plot with Ipympl – Image by the author.

To use Ipympl’s interactive functionality, you can install it with Conda/ pip:

conda install -c conda-forge ipympl
pip install ipympl

If you are using Jupyter Lab, you also need to install node js and jupyterLab extension manager.

conda install -c conda-forge nodejsjupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter lab build

If you want to get started and set up your environment, you can read this article.

How to produce Interactive Matplotlib Plots in Jupyter Environment


IpyLeaflet

IpyLeaflet is a bridge between the worlds of Jupyter notebooks and the popular Leaflet Visualisation library. With Ipyleaflet, you can create an interactive and advanced geospatial data visualisation with the help of Ipywidgets. It also allows you to create bi-directional communication maps.

Search bar and Fullscreen zoom with IpyLeaflet - Image by the author
Search bar and Fullscreen zoom with IpyLeaflet – Image by the author

To install IpyLeaflet, you can use either Conda or pip.

conda install -c conda-forge ipyleaflet
pip install ipyleaflet

You will also need to enable JupyterLab extension:

jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-leaflet

I also have an extensive and beginner’s guide on Ipyleaflet Interactive mapping here:

IpyLeaflet: Interactive mapping in Jupyter notebook


KeplerGL-Jupyter

KeplerGL Jupyter notebook extension comes with one of the best Geospatial data visualisation tools for big data. With this extension, you have a powerful user interface right in Jupyter to create interactive, beautiful maps.

With KeplerGL Jupyter Lab extension, you can combine world-class visualisation tool, easy to use User interface (UI), and flexibility of python and Jupyter notebooks (3D Visualization GIF)

3D building footprints with KeplerGL Jupyter - Image by the author
3D building footprints with KeplerGL Jupyter – Image by the author

To Install Keplergl Jupyter notebook, just run these three lines on your terminal.

pip install ipywidgets
pip install keplergl
$ jupyter labextension install @jupyter-widgets/jupyterlab-manager keplergl-jupyter

To get started using Kepler, you can read this article:

Kepler.GL & Jupyter Notebooks: Geospatial Data Visualization with Uber’s opensource Kepler.GL


Conclusion

JupyterLab is my favourite tool, and the availability of these Geospatial extensions makes me stick 👌🏻 with it and not revert to Jupyter Notebook. In this article, I have shared the four must-have JupyterLab extensions specifically for geospatial data scientist and Geo folks.

Let me know if you use some other specific JupyterLab extensions for your Geospatial data science applications. You can reach me @shakasom on Twitter.


Related Articles