Mplleaflet vs Folium to plot your weather stations on a Jupyter Notebook

When analyzing climate data or any other geospatial data on a Jupyter Notebook, we need to plot points, lines and polygons interactively. Based on our own way to learn Python, most probably we will use a library that we found on Google or Stackoverflow however there are some undercover issues on the library selection that we will discuss in this article.

Two libraries, one application

Mplleaflet and Folium are not that different since both use Leaflet.js to represent maps, and supposedly both can plot points, lines, polygon, specify the system of reference, define the canvas area and zoom and select background maps.

But, why do we have two libraries that do the same? We might have to ask that to the package developers: Filipec(ocefpaf) and Jacob Wasserman (jwass) and we even have to ask that to the contributors. We don’t have a clear idea about the governability in the development of open source geospatial packages, perhaps both packages exist as long as people use them.

Some examples

We have developed two small examples for the representation of weather stations in Louisiana, US

Mplleaflet example

Folium example

Selection criteria

In our perspective, Mplleaflet has the advantage to represent anything that is on a Matplotlib plot while in Folium you have to specify any object as a layer. On an everyday use of Mplleaflet you will find some warning and some issues with Matplotlib and upon the computer/windows/anaconda version the library doesn’t work at all.

To solve this we have to look at some key parts of any package: the released versions and the date of the latest version. An updated package would mean that it is compatible with the latest version of its dependent libraries and that the package has fixed the latest bugs. When we analyze the latest versions on the Python package index (PyPI.org) of Mplleaflet and Folium we see:

The latest release of Mplleaflet was on 2015 (6 years ago) while the latest release of Folium was just some days ago. Then, the criteria for the package selection based on the release history seems clear: Folium is a strong choice for the representation of geospatial data although Mplleaflet seemed more easy to use.

We hope that this article could help you to select not only geospatial packages but also other packages since the way we programm is mostly self taught and we lack common concepts for language/package use.

Comment

Saul Montoya

Saul Montoya es Ingeniero Civil graduado de la Pontificia Universidad Católica del Perú en Lima con estudios de postgrado en Manejo e Ingeniería de Recursos Hídricos (Programa WAREM) de la Universidad de Stuttgart con mención en Ingeniería de Aguas Subterráneas y Hidroinformática.

 

Suscribe to our online newsletter

Subscribe for free newsletter, receive news, interesting facts and dates of our courses in water resources.