Build Geospatial Visualizations with MongoDB Charts

MongoDB Charts now supports a range of geospatial chart types, allowing you to render data on a map, making it easy to expose trends, gain insights and tell stories using your geographic data.

When it comes to visualizing data, there is no one “right” way to do it. The best approach will depend on what the data represents and what you want to communicate. If you have a bunch of categorized data, a bar or column chart may be a good fit. If you have time series data, a line chart may make more sense. Increasingly, many of us are storing data that relates to places in the real world. In this case, nothing beats a map.

MongoDB Charts is our data visualization solution, providing the quickest and easiest way to visualize data stored in MongoDB Atlas or on-prem. As its name suggests, Charts lets you build lots of different types of common charts, as well as displaying tables and numbers. With the new release we launched at MongoDB World 2019, we’ve added three different geospatial chart types to the mix, giving you great new ways to visualize your geospatial data.

The best way to see how a geospatial visualization works is to see it in action. We are going to take a look at each one of the three new chart types, show when they are most useful and then look at how to build and customize them. For all of these examples I’ll use the same data, available on Github, which is a collection listing the exact locations of radio transmitters in Australia. This is what the Chart Builder looks like when I select this data source. Notice how the fields from the collection are shown in the field panel. I’ve also selected the Geospatial chart category, revealing the three available chart options below.

Geographic Chart Types


The first geospatial chart option is the choropleth. Even if you haven’t heard this name before, you’ve probably seen many examples of this chart type. A choropleth is a map where regions, such as states or countries, are shaded based on some value. For example, a choropleth may be a good way of depicting the crime rates in different states, or the life expectancy in different countries.

One interesting property of choropleths in MongoDB Charts is that you do not need to have latitude and longitude data in your collection to create the chart. Instead, all you need are string values that represent the name (or supported abbreviation) of a region in one of the supported shape schemes. In this release of Charts, the supported schemes are Countries and Regions, Australian States, Australian Local Government Areas, Canadian Provinces, German States, UK Countries, UK Counties and Districts and US States. So if your data has string values like “California” or “CA”, you could choose the “US States” shape scheme and create a choropleth.

With my dataset, I can create a choropleth that shades each Australian state to show the number of transmitters in each. To do this, I simply map the “state” field to the Location channel, and the “_id” field with the Count aggregation to the Color channel. Finally, I need to use the Customize tab to tell Charts to use the “Australian States” shape scheme, or nothing will match. If I wanted, I could also customize the color palette, opacity and map viewport.

Choropleth map of transmitters per state

Geo Scatter

The second geospatial chart type is the Geo Scatter. Not to be confused with the Scatter chart under the Grid category, a Geo Scatter chart shows a circle for each document or documents that lie at precise geographical coordinates. You can change the color and size of each mark based on other fields in your collection. A Geo Scatter chart is great to show precisely where items are in the world. Note that currently a Geo Scatter chart can only show 1000 distinct points.

Unlike the choropleth, the Geo Scatter requires that your data contains latitude and longitude coordinates. These are best stored as GeoJSON points, but Charts also allows you to map coordinates from individual latitude/longitude fields or from an array.

For my next chart, I want to show the exact locations of all transmitters in New South Wales. After using the Filter tab to restrict my data to my chosen state, I can encode the “location” GeoJSON field in the Coordinates channel. To provide a bit more information, I’ll also encode the “band” field in the Color channel (so I can distinguish between the AM and FM stations), and the “_id” field with the Count aggregation in the Size channel (so I can see how many stations are broadcast from each transmitter). I’ve also made some tweaks to the Opacity customization option.

Geoscatter map of transmitter locations in New South Wales

Geo Heatmap

The final chart type is the Geo Heatmap. Again, do not confuse this with the Heatmap in the Grid category. The Geo Heatmap shades areas on a map based on the combined values of data points within a certain geographical radius. This chart type is good for showing trends in localized areas, such as parts of a city with high or low rents, or the population density across a state.

Building a Geo Heatmap in Charts is very similar to building a Geo Scatter chart. Like the Geo Scatter, a Geo Heatmap requires latitude and longitude data. However, the Geo Heatmap only has one other channel, called Intensity. Whatever field and aggregation function you map here will dictate how the areas are colored. For my chart, I’ll map the “location” GeoJSON field to the Coordinates channel, and the “_id” field with the Count aggregation in the Intensity channel.

Geo Heatmap showing the density of transmitters

There are a couple of other things about the Geo Heatmap that are worth calling out. First, the intensity colors are specific to the current map view. That means that if you zoom and pan the map, the scale shown on the legend will change so that the most intense color represents the most extreme value within the current map view, not within the entire dataset. This makes it easier for you to understand your data at different levels of detail.

Second, you should pay special attention to the Radius customization option under the Customize tab. This is a configurable option that specifies the size of the circles in which your data is aggregated. Depending on your data, either a larger or smaller radius size could make the map easier to understand.


The Geospatial chart types are the latest way of visualizing your data in MongoDB Charts. They offer the perfect way to tell stories about your data where there's a geographic dimension to that data. You can try them today by signing in or signing up for MongoDB Atlas and activating Charts. If you need more help, please check the docs, and let us know if you have any feedback or suggestions by using our Product Improvement Board.

Want to learn more about Geospatial Charts? Sign up for the webinar "Get the Best of Geo Data with MongoDB Atlas and MongoDB Charts" on July 10th and see live demonstrations of the chart creation.