At Ambee, we are big believers of open source. To help advance the geospatial industry in the areas of geospatial data application, this project is one step towards that direction.
For developers, coders, and data scientists around the world, as much as we like coding, sometimes the task gets tedious and monotonous. Especially if the task is as simple as plotting something on a map. To ease up the burden of consistently doing such tasks, we have developed a new library that requires only a single line of code to plot and customize maps without overlooking the look of it.
Introducing Gspatial-plot by Ambee.
Gspatial-plot is a geospatial plotting library built on top of GeoPandas. The aim of this library is to simplify the generation of geospatial plots and provide a simple interface to various commonly used geospatial plot types.
Geospatial-plot is also another way for us to help make lives easier and make a difference in the world of technology and climate. It is an open-source library for anyone interested in utilizing the resources. For further details, you can visit the documentation.
A simplified plotting interface for GeoPandas
GeoPandas is one of the most essential libraries for geospatial processing in Python and is a core part of the geospatial data science stack. For plotting basic plots, GeoPandas is simple and great. However, if you want to plot different types of thematic maps, such as a bubble plot or a cartogram, or if you want to plot a density map, you’ll find yourself doing a lot of manipulation and tinkering around matplotlib to produce a good looking graph.
We wanted a solution where we could produce a good-looking map with a single line of code and still be able to customize the plot the way we want. That’s why we developed gspatial-plot, a simplified plotting interface for GeoPandas. With gspatial-plot, these were our goals:
A very simple API
Better default settings for plots
Easy way to customize
Should be compatible with other GeoPandas and matplotlib axes
Simple functions which take in just the bare minimum information needed for plotting thematic maps
You can install gspatial_plot using:
pip install gspatial-plot
Example: You can generate a cartogram in a single line of code
Our main aim was to make a seaborn-like interface for gspatial-plot. There already exists a library called geoplot that aims to do this, but by no means, gspatial-plot is a drop in replacement, and there are some methods available in geoplot that aren’t implemented in gspatial-plot and vice versa.
Gspatial-plot provides a simple way to plot choropleth maps, bubble maps, cartograms, density plots, heat maps, and spike maps, and it also implements replacements to default GeoPandas plots such as pointplot and shapeplot. These do the same thing as GeoPandas plot function but have better defaults and more easy-to-access settings. We also have a function called randommap which assigns each shape in a geodataframe, a color based on a predefined list of colors or a custom list of colors. We also can annotate the shapes easily by passing annot=True and the annotation column, such as the name of the geographic feature.
Apart from this, gspatial-plot also has two more useful functions — offline_static_basemap and offline_folium_basemap. These two functions use natural earth vector data in order to provide a basemap. The color, opacity and edge thickness of land, ocean, boundaries, and lines are customizable, and it does not need an active internet connection. This is useful in situations where you need a basic basemap to show data but you do not need nuances that an online basemap service like OpenStreetMap provides.
Gspatial-plot is in beta, and it is fairly stable from our testing, if you find any issues, please report them on GitHub!
You can find the links to Ambee’s latest project below:
gspatial-plot is licensed under a permissive MIT License.
Why has Ambee developed Gspatial-plot?
Geospatial technology as an industry requires help from industry counterparts to ensure the development of new applications and the effective utilization of geospatial data.
Talking about this initiative by members of the Ambee team, CTO and co-founder Maddy said,
We at Ambee have been consistently developing new projects to not only make our lives simpler but also help developers and innovators create something great. Stay tuned for more of our open-source projects.
Liked what you just read? Share it with a friend.
Have questions? Get in touch!
Request submitted. Our team will get in touch with you shortly!
Oops! Something went wrong while submitting the form.