Free tools for spatial data visualization

Linnart Felkl M.Sc. ETH
4 min readAug 20, 2022

--

Supply chain network design can benefit greatly from spatial data visualization. For example, transparency in a warehouse relocation project can be greatly improved by visualizing material flows and critical transportation routes as well as e.g. spatial customer location distribution. In this blog post I present tools that can be used for this. All of the tools presented by me are available as packages or modules in either Python or R. Hence, they can be used for free. Moderate data analysis skills in R or Python are required to be able to apply these tools.

ggmap in R allows for map-based plots and animations

If you are used to R you will know ggplot2 for data visualization. You can think of ggmap as an extension of ggplot2. ggmap allows for map-based plots. Here is an example of a k-means density plot that I created as part of a research project for a major German university.

And here is another example, comparing different kernel density plot coloring themes.

ggmap applies the same “grammatics” as ggplot2. This means that if you are used to working with ggplot2 you will be able to generate plots in basically the same way as you are already used to. Another good thing about ggmap is that it (like ggplot2) is compatible with gganimate. This means that you can use ggmap in order to be able to create map-based animations. You can see how to do this in another blog post that I published on SCDA: Spatial data animation with ggmap & gganimate.

Leaflet is available in both R and Python (among other languages)

The Leaflet library can be accessed in R and Python. It allows for drawing nicely looking heatmaps. You can see an example below.

Above example shows a heatmap that illustrates a monte-carlo simulation in which I randomized customer locations to assess the risk associated with warehouse allocation. Below is another example comparing spatial distribution in Google search trends for two keywords.

Using Leaflet in R or Python, much like other tools, allows users to adjust the tiles and coloring themes of the map. It is also possible to adjust heatmap visualization by e.g. adjusting the radius of overlapping circles. Here is another exemplary visualization of the same data.

Markers or custom icons can be used for visualizing spatial distribution as well. Here is a marker plot that I created with Leaflet in R.

Back when I developed these examples I was comparing Google search trends for the keywords “Pizza” and “Hamburger” in Germany. It is good that Leaflet allows me to customize marker icons, as you can see in below plot.

Visualizing and comparing spatial distributions in this way e.g. contributes to a better understanding of relevant customer groups and markets.

deckgl can be accessed in R and allows for 3D plots

Using deckgl in R spatial data can be visualized on top of mapbox tiles in 3D. Here is an example showing an artificially generated distribution in the form of 3D bars on top of a mapbox map.

Besides 3D bar plots other types of 3D visualizations can be created with deckgl. Here is another example showing a map-based scatterplot.

Flight routes (line paths), tuck routes (arcs), and much more can be visualized with deckgl, too. All of these plot types can be combined. For example, flight and truck routes can be visualized on a map that shows customer locations in the form of a scatter plot.

--

--