A heatmap is a way of representing data that allows you to visualize both data point density as well as the relative differences between points based on data properties. They are a visually engaging way to encourage your audience to explore the data displayed on your map.
In this tutorial, you will use Mapbox Studio to create a heatmap that displays the location of meteorite strikes around the world, based on data collected by NASA. You will also use the weight of each meteorite in grams to display the relative size of each meteorite.
To complete this tutorial, you will need:
To add the meteorite strike information to a style in Mapbox Studio, you need to upload it to your account first. To upload this file to Mapbox Studio:
meteorites.csv
. To do so, you can either:When the upload is complete, there will be a notification icon in the lower right corner of the screen.
Now that you have uploaded the meteorite strike information as a tileset, you can add it to a new map style.
To add and style the meteorite strike data as a heatmap layer, you will need to add a new layer to the style you created.
A heatmap layer in Mapbox Studio has several different layer property options. Understanding what these properties mean is key to creating a heatmap that accurately represents your data and strikes the right balance between showing too much detail and being a large colorful blob!
In a heatmap, the radius of the points should increase as the zoom level increases to preserve the smoothness of the heatmap as the points become more spread out. For this tutorial, you will change the default (a radius of 30 px
at all zoom levels) so that the radius increases as the map is zoomed in.
0
(zoomed out to the maximum extent) to 5 px
.22
(zoomed in to the maximum extent) with a radius of 30 px
. Leave this stop with these settings.In the tileset you uploaded, the mass(g)
property ranges from 1-60000000 grams. That's a wide range of meteorite sizes! Give more weight in your heatmap to the larger meteorites by setting stops that increase the weight of a point as the mass increases.
mass(g)
.0
and a weight of 1
. Leave this stop at these settings.25
.Done
.The intensity of the heatmap layer can be increased as the map zooms in, to preserve a similar appearance throughout the zoom range.
0
and an intensity of 1
. Leave this as it is.22
and an intensity of 10
.These images show the impact of intensity on your style's appearance. The image on the right shows intensity that uses the default of 1
, while the image on the left shows intensity that increases with zoom level.
Heatmap layers in Mapbox Studio come with a vibrant set of preset colors with which to represent the density of the data points. For this tutorial, though, we will change the color scheme. We've taken these colors from a color recommendation site that's specifically for cartography, Color Brewer.
0
and an opacity of 0
. Without these settings, the meteorite layer would be opaque, obscuring the rest of the map. Leave this stop at these settings.0.1
. Change the color to #ffffb2
.0.3
: #feb24c
0.5
: #fd8d3c
0.7
: #fc4e2a
1.0
: #e31a1c
Your heatmap is looking good, but it's difficult to read location labels since the meteorite strike points obscure them. Adjust the heatmap layer's opacity so that you can read the labels:
0.7
, either by using the slider bar or by typing the number in directly.When you finish editing your map style, publish your changes by clicking Publish in the upper right side of the screen. When you click the publish button, a window will display the difference between the previous and current version of this style. If you're happy with the changes, click Publish. Your style will now be available to share from a variety of tools and applications.
If you go back to your Styles page, you will see your new style at the top of the list.
You have created a style that displays meteorite strike data from around the world, in a way that also allows you to show the relative mass of each meteorite.
Congratulations on completing this tutorial! You have created a heatmap layer in a Mapbox map style that displays meteorite strike data from around the world.