Creating a Tableau map with Satellite image background - Part 1

Version 2

    Okay, so you likeLOVE Tableau's features allowing you to map your data. But, maybe you would also like the option of seeing a satellite image view, over which you can map your data. But Tableau does not offer that feature - by itself anyway.


    This is one way Mapbox can help. Beginning with Tableau 9.2, support for Mapbox styled background maps is directly supported! Mapbox is a third-party online product which allows you to create your own custom stylized maps.


    Other helpful examples have been published, including Think Data Thursday: Mapbox Integration | Tableau Software which was an inspiration for this. This is intended to build upon that work. Many others can be found as well. I do not profess to be an expert, just someone who wants to help you avoid some of the problems I encountered, and get you started quickly.


    Mapbox examples and documentation can be challenging. There are very important things that can take significant work to find, and some odd things happen along the way. Hopefully, this will help you rapidly get past things that took me many hours to resolve. Throughout this, I will highlight challenges to watch for.


    Getting Started


    Let's start with the basics. First, you will need a Mapbox account. Just to get started, you can create a free account. The limits of the free account are:

    • 1 GB of storage
    • 10 Mapbox Studio styles
    • 1 Mapbox Studio Classic style


    The first two of these are not a big problem for most simple projects. However, the last one can be annoying, since Mapbox Studio Classic is the only style currently directly supported in Tableau. It is important to note that Mapbox Studio Classic is NOT the same as Mapbox Studio. This limitation means that you must delete your first uploaded style if you want to try a second. Fortunately, your styles are saved locally too, so you can just delete the second and re-upload the first if needed.


    So, go ahead and create your Mapbox account at Mapbox | Design and publish beautiful maps.


    Now, you will need to download and install Mapbox Studio Classic from Mapbox | Design and publish beautiful maps.  (This can be difficult to find. I recommend using the link.)


    Next, you need to get your Mapbox API access token. So, go back to the Mapbox website, login to your account (if you aren't already logged in) and click Studio.

    It can be found in the Account page (lower left button), under API access tokens (top bar), near the bottom of the page. It is very long (I have blocked mine out in red), and you can just copy it to the clipboard by clicking the button beside it.

    Now open Tableau 9.2 (or higher), and, for this demo, create a new workbook using the sample Superstore database. Put Latitude (generated) on Rows and Longitude (generated) on Columns. From the Location dimension group, drag State onto the Detail shelf. You should now have a map with dots in the states. Select the Map menu->Background Maps->Map Services. Then click the Add button and select Mapbox Maps. The style name you enter here will be the name you will select for your background map in Tableau. It does not need to match anything in Mapbox. For this example, I just named it "Satellite.". Now paste the API access token that you copied above. You can just leave that window in Tableau open and launch Mapbox.


    Basic Example


    For our first example, we are going to keep it really simple, and just have a default built-in style for a satellite view.


    1. Launch Mapbox Studio Classic, select "Styles and Sources"


    2. Select "+ New style or source"


    3. Select "Streets - Satellite"


    4. Click "Save as"


    5. Name it, for example "Satellite - streets," and click Save


    6. Click "Settings"


    7. Click "Upload to Mapbox"


    8. When the upload is complete, you will be provided a map ID. Select it by dragging across it with your mouse, and copy it (i.e. Ctrl-C). My example is no longer published, so that map ID will not do any good for you. You will need to get your own.


    9. Switch back to Tableau. In the "Add Mapbox Map" dialog box, which should still be open, click "Custom," and paste your Map ID on the line that says "Add layer by Map ID." Tab off of this field to enable the OK button, and click OK.


    And POOF! You now have a satellite view! Explore it by filtering to a State of your choice, zoom in on familiar area. Watch how the view changes as you zoom. You can also plot your own data on it, just like any Tableau map.. Cool, huh?


    Are we done? Well, that depends. Are you happy with it as it is? If you are, thanks for playing.  However, do you notice that there are no state border lines? Would you like county lines and labels? With the default Tableau background map, you can turn on and off layers like state, county, and zip code lines and labels. With what you just produced, you don't have those options. What can you do about it? Make your own!


    In Satellite Background Map in Tableau - Part 2 - Adding County Lines, you will learn how to add county lines, but the same technique will work for any geographic polygon for which you can find a shapefile.


    Then, in Satellite Background Map in Tableau - Part 3 - Labels and Styling we will spruce this up a bit by adding labels for the counties, and adjusting some of the original CartoCSS.


    I hope you find this helpful. If you have questions about this document itself, like a step I missed or something that wasn't clear, feel free to post it here so I can improve the quality of the document. However, if you have general questions about Mapbox, or other things you are wanting to accomplish, please post them in the Forum, where others will see it and contribute.