11

Using Custom Mapbox Maps in Tableau

 3 years ago
source link: https://datavis.blog/2020/10/26/using-custom-mapbox-maps-in-tableau/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Using Custom Mapbox Maps in Tableau

singapore-national-day_2020.jpg?w=1400

For a recent visualisation I created about Singapore’s National Day, I wanted to provide a geographical context for the subject matter, showing historical points of interest in the city state along with locations of past National Day Parades. I also wanted the style of the map to be in keeping with the charts used and match the colours used on Singapore’s National Day Parade website.

To achieve this, I used a custom Mapbox map as a background to the visualisation that filled the entire canvas and provided an informative and aesthetic backdrop.

singapore-national-day_2020.jpg

Default Mapbox Maps in Tableau

Tableau switched to using vector maps from Mapbox in early 2019 (which I reviewed here) and by default you have access to the following map styles within Tableau:

  • Light
  • Normal
  • Streets
  • Outdoors
  • Satellite

An examples of each of these is shown below (click to expand):

  • 06-satellite.png?w=736
  • 01-light.png?w=736
  • 02-normal.png?w=736
  • 03-dark.png?w=736
  • 04-streets.png?w=736
  • 05-outdoors.png?w=736
  • 06-satellite.png?w=736
  • 01-light.png?w=736

Map Layers

Each of these default maps provides a Layers panel in Tableau where you can switch on or off various map details such as:

  • Land cover
  • Coastline
  • Streets and Highways
  • Country/Region Borders
  • And many others…

For more details, see this Tableau help page.

This combination of different default maps and toggleable layers provides a lot of flexibility and variation which covers the majority of use cases. However, if you want to customise your maps further, this can be done via Mapbox Studio. 

The below steps walk through how I created the custom map for the above Singapore visualisation.

Create a Mapbox Account

If you don’t already have a Mapbox account, go to the sign-up page to create a free account: https://account.mapbox.com/auth/signup/

Choose a Template in Mapbox Studio

Once you’ve created your account and logged in, go to the Studio page:

08-mapbox-studio.png

Then click on New style:

09-new-style.png?w=416

Then, select a template map as a starting point. For this example, I used Monochrome, with a variation of Bubblegum.  Finally, click Customise Monochrome

10-customise-style.png

Customise the Template Map

The reds used for most elements in the Bubblegum template are a good enough match for what I wanted for this visualisation, so I only needed to make one customisation, which was the colour of the water.  I changed this from a dark pink to a mostly grey colour with a slight pink tone.

To customise any element, you can click anywhere on the map to show the layers that are used at that point.  Clicking on an area of water below, I can see there are Land and Water elements:

13-click-on-map.png?w=519

Switch from Components to Layers to show more detail and to pick a specific layer:

14-show-layers.png

Click on water to show all the details for that layer in a panel on the left of the screen, where changes can be made.  Before making changes, it’s necessary to click Override to unlock the interface. I then just selected the new colour for the water using the colour swatch.  The old and new colours are shown below the swatch:

16-water-updated.png?w=395

Similar changes can be made in this way for road colour, land colour, buildings and so on.  Mapbox allows for customisation down to a very fine level of detail.

A comparison of the default Bubblegum style versus the customised version can be seen below

  • 11-monochrome-bubblegum-1.png?w=980
  • 12-customised-map-1.png?w=980

Publish the Map

When all customisations have been made, click the Publish button in the top right corner:

17-publish.png?w=392

A preview will show with a slider that allows you to easily see a before and after view so you can confirm that changes you made are what you want.  Click Publish once more:

18-publish-my-map.png?w=660

A popup shows to confirm the map was published;

19-confirmation-of-publish.png?w=396

Create a Map URL for Tableau

To use the new map in Tableau we need an integration URL. To create this, first click the Share button in the top right of the screen. (Notice the Publish button is now greyed out as I haven’t made any customisations since I last published).

20-share.png?w=396

Then, on the popup screen:

  1. Click Third party
  2. Select Tableau from the drop down list
  3. Click the clipboard icon to copy the URL
21-copy-url-1.png?w=495

Add the Mapbox Map in Tableau

To begin using the new customised map in Tableau, first select the sheet that contains the map in Tableau, then select Add Mapbox Map… from the menu as shown below:

22-add-mapbox-map-1.png?w=352

On the popup that appears, give the map a name and paste in the URL copied from Mapbox Studio

23-paste-in-the-link.png?w=379

Once you click OK, the view in Tableau will update to use the new custom Mapbox map.

Further Information

Custom Mapbox styles open up all kinds of opportunities for creating beautiful maps for your visualisations. For inspiration and examples of what’s possible, take a look at the Tableau Public profile of Jonni Walker.

I hope this was useful and thanks for reading.

Marc Reid
Twitter | Linked In | Tableau Public


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK