Great Arcs in Tableau by Chris DeMartini


This is one of many posts on the subject of Great Arcs which ultimately lead us to the re-make of the 1983 cult classic Wargames in Tableau. I encourage you to read the whole series of posts by the wider team in addition to this one.

Why Arcs? … I say Why Not?

Beyond the why not and the fact that they are more aesthetically pleasing to the eye, I have found that the use of curves, arcs, etc. helps to significantly reduce over plotting when visualizing relationships between nodes (or cities). As an example, compare the below image to the header image, same data, same locations, same amazing Mapbox map created by Anya, only difference is the curves and that I got a little lazy with the colors below.

great arc 0.1

At this point if you are asking yourself what is a great arc (or great circle), please take a quick minute to go through this tutorial on the site. I found this walk through (embedded below) to be a very helpful explanation of the great arc concept with respect to our globe.

Now that we have answered the why, we should all say a big “thank you Alan Glennon!” Wherever and whoever you are out there, this post would have taken significantly more time to create if it wasn’t for the Python code you shared.

Here is Alan’s code posted in the linked thread…

great arc 1great arc 2

Once I stumbled upon this, I ported the math from Python to Tableau. In the spirit of leveraging the work of others, this post is based around the concept of you “copy and pasting” from my work to incorporate great arcs into your own Tableau workbooks. Outlined below are the steps that you will need to complete in order to make your own arcs.

Step 1: Get your data ready. Since we are building a map with paths (and also using one of my favorite tricks, data densification) we need to structure our underlying data accordingly. Sadly we cannot perform calculations on Tableau’s generated latitude and longitude, thus we need to source the coordinates in our data (see the note below on this). Here is what I am going to start working from for the purpose of this post.

great arc 3

Here are the steps we take (assuming you are in Excel) to prep our data. If you are planning to copy and paste the formulas from my workbook, please follow my field names exactly so you don’t run into orphan fields within the calculated fields.

  1. Add “Path” field with unique identifier for origin/destination combination (I am lucky and already have “ID”).
  2. Add “Path Order” field with value of 1.
  3. Copy the above two fields down your entire data set.
  4. Copy the entire data set (including the new fields) and paste it below itself with one blank row in between.great arc 4
  5. Update the second block of data to have path order value of 2.
  6. Delete the blank line between the two blocks (this is only there to keep track of where one block stops and the other starts).
  7. Sort the data by path and then path order. Your data should now look like this.great arc 5
  8. All columns are duplicated except for path order. This is what Tableau likes to see!

Note: Above I assume you have latitude and longitude field values in your data. If you don’t put your data into Tableau, have Tableau generate the latitude and longitude for each location. View the data in Tableau and then copy and paste that into Excel. You can then join the Tableau generated latitude and longitude back to your original data. Congratulations you just geo-coded your data via Tableau!

Step two: Bring your data into your Tableau workbook. Download and open a copy of my Tableau Public workbook embedded in the blog below. Go ahead and make a straight line map with path for comparison later… Here is mine

great arc 6

Step three: Now that you have your prepped data and a copy of my workbook ready to go, all that remains is copy and paste, creating a bin and some dragging and dropping.

  • Copy and paste the field “BezierValue” to your workbook.
  • Right click the “BezierValue” field and select create bin (make sure bin size is 1)
  • Next copy the following fields (I have them somewhat grouped in my workbook so it should be easy to do all of these at once. You may be tempted to copy all these fields with BezierValue, but trust me that it is easier to do BezierValue first, create the bin then copy and paste the rest of these. (See note below if you get errors on this step)

great arc 7

  • Make sure the gc_newlat_degrees has geographic role of latitude
  • Make sure the gc_newlon_degrees has geographic role of longitude
  • Drag gc_newlat_degrees to rows
  • Drag gc_newlon_degress to columns
  • Drag Path to Detail
  • Drag BezierValue (bin) to detail
  • Change mark type to line
  • Drag Bezier (bin) to path (make sure show missing values is enabled)
  • Size as small as possible, Transparency to something like 10%

great arc 8

And viola! There are now great arcs in YOUR Tableau workbook. I chose not to get into the math in this post, however, it is all in the workbook below and based on the python code I referenced in the beginning of the post. Feel free to dissect the math as much as your little heart desires.

Note: If you get an error on your fields when copying and pasting the calculated fields into your workbook it is likely due to your latitude and longitude having different names. You have two options here: (1) undo the paste, change your field names and paste again, or (2) update the ptlat_radian and ptlon_radian (and a few other) fields to point to your latitude and longitude fields respectively.

Wargames! (gifs courtesy of Allan Walker)

mercator wargames polar wargames

When I showed this to Allan Walker and Anya, we had a quick conversation around the correct use case to support the need for great arcs in Tableau. It did not take long for the group to land on the 1983 movie Wargames (of course!). So, without further ado, we give you Wargames in Tableau...


Building a Visualization of Transit System Data Using GTFS


Yes, yet another Allan Walker and Anya post about mapping things :-).  This one however is a precursor to some very fun JS API how to's, including how to animate the viz, coming soon featuring Chris DeMartini .  Stay tuned!

Q:  Um, what is GTFS? 

A:  The General Transit Feed Specification (GTFS) defines a common format for public transportation schedules and associated geographic information. GTFS "feeds" allow public transit agencies to publish their transit data and developers to write applications that consume that data in an interoperable way. 

Screen Shot 2015-05-02 at 4.51.10 PM

Q:  And I care because? 

A:  Use Tableau to build a map of transit data and incorporate it in a BI dashboard for analysis.  What is the average route duration, fare, number of stops?  How many are wheelchair accessible?   Don’t care about BART?  Check out the list of all the agencies that use this format at .

Step 1:  For the sake of this demo, visit the

Screen Shot 2015-05-02 at 4.51.02 PM

Step 2:  Download the GTFS zip file at

Unpack the zip file

Screen Shot 2015-05-02 at 4.51.14 PM

Visit the GTFS specification website, noting the fields that occur in the tables.  There is a ton of juicy bits in there.  Have your way with them!

Screen Shot 2015-05-02 at 4.51.18 PM

Fire up Tableau and begin joining the tables.

Start with the trips.txt

The joins are inner and magically delicious and just happened when you click a table to add it, but just in case here they are:

  • trips.txt to calendar.txt on service_id
  • trips.txt to calendar_dates.txt on service_id
  • trips.txt to routes.txt on route_id
  • routes.txt to agency.txt on agency_id
  • routes.txt to fare_attributes.txt on agency_id
  • trips.txt to stop_times.txt on trip_id
  • stop_times.txt to stops.txt on stop_id
  • Extract the data (Optional – filter for a specific day to speed things up a bit while you play with the data)

Screen Shot 2015-05-02 at 4.53.41 PM

Let’s create our first Calculated Field (CF), based on [Departure Time]:  “CF-Time”.  First, change [Departure Time] to a string, and add the calculation:

RIGHT([Departure Time],11)

Screen Shot 2015-05-02 at 4.53.48 PM

Next, let’s create another Calculated Field to concatenate [Date] and our [CF -Time] field: “CF-DateTime”.

Screen Shot 2015-05-02 at 4.54.11 PM

Make sure that your [Stop Lat] and [Stop Lon] are dimensions.  Drag [Stop Lon] onto the columns and [Stop Lat] onto the rows.  You can now see all the stops (BART Stations) on the BART route.

Screen Shot 2015-05-02 at 4.54.34 PM

Drag [Route Color] onto color – these are hex values that correspond to the color of the BART system map.  (Note that some stops are serviced by more than one route, and only the top color in the sort order will appear. 

Screen Shot 2015-05-02 at 4.54.43 PM

You could go pie chart on the stops, but you would be harassed to no end by Andy Kriebel.   If you need to convert Hex colors to RGB, use a website such as, otherwise change the colors in Tableau to match the Hex code.  They will now match the colors on the real BART Map.

Screen Shot 2015-05-02 at 4.53.53 PM

Make sure the mark shape is a filled circle and add a black halo using the color card.  This is just for formatting but it will make the stops look more like the ones on the original BART map when you are done.

Screen Shot 2015-05-02 at 4.54.48 PM

Then Move the [CF – DateTime]  to the Pages Shelf.  Using the arrow to the right of it, choose Exact Date.  This will speed things up, but also let you see what a day in the life of the BART looks like.

Check the Show History box, selecting “All” history and “Both” marks and trails. 

Screen Shot 2015-05-02 at 4.55.01 PM

Drag the Pages slider all the way to the right or just hit play and wait (or go get a beer while it plays).  It's a total mess!

Screen Shot 2015-05-02 at 4.55.14 PM

Drag [Trip ID] onto Level of Detail

Click “play” on the slider to see trains depart each station on the BART Routes!

Screen Shot 2015-05-02 at 4.55.18 PM

Let’s add some labels, and tidy up the stations.  Add [Stop Lon] again to the Columns Shelf and create a dual-axis. 

Screen Shot 2015-05-02 at 4.55.22 PM

Change the mark type to circle for the second mark type.  Remove the Color pill for [Route] and change the color of the circles to white if you want to look like the example.  Add [Stop Name] to Label, allowing labels to overlap other marks

Make the Map Black, because Allan likes to get all Johnny Cash and makes everything a black.  But really, just go to your Map menu, and select Map Options and play to your hearts content. 

Screen Shot 2015-05-02 at 4.55.29 PM

Now it’s time to create a dashboard with our map.  Add the map you just created to the dashboard and move the pages controls to the bottom.

Let’s create a “timer” in a second worksheet.  This will display the latest time being show in the Pages Shelf.  In the new worksheet, Drag [CF-DateTime] to the Pages area and change to show Exact Date just like we did on the other worksheet.  In “Show History”, only show the last 1 mark, also check the “Fade” box. 

Add [CF-DateTime] to the Text card, and change it to Exact Date.

Screen Shot 2015-05-02 at 4.55.31 PM

We will use this sheet as the header of the dashboard.  Click on the Text Card and add the text “BART Trains at: “ before the field [CF-Datetime]  Make the text big, and bold and in the color of your choice. 

Screen Shot 2015-05-02 at 4.55.34 PM

Add Sheet 2 to your dashboard at the top and hide the title.

Let’s build some charts to complement the map.  Sheet 3 is built using the set-up of circle mark type, history as trails,  and a Count of the TripID by Route Long Name in the Rows:

Screen Shot 2015-05-02 at 4.55.47 PM

The view above shows for each minute or two that the pages go through how many BART trains actually have a record.  As the trains only have a record when they depart a station and it may take more than a minute or two to reach the next station, you may choose to create moving average of the count of the [Trip ID] to smooth out the lines a bit.

Screen Shot 2015-05-02 at 4.55.39 PM

Add any new views to the dashboard, but remember for the animation on the Pages slider to work, they all need to have the [CF-DateTime] in the Pages shelf, and all need to be set to “Exact Time”.  Rearrange, and bend to your will.  Go get another beer and show a friend how much you rock now that you can animate transit systems in Tableau, and mix BI, Data Viz and GIS together.

Screen Shot 2015-05-02 at 4.56.10 PM

Optional Note:

Perhaps the fact that the lines overlap bothers you, as only the top line shows.  If so, just add a bit of "jitter" to your lines to space them a bit apart.

Screen Shot 2015-05-04 at 2.24.14 PM

Screen Shot 2015-05-04 at 5.11.13 PM

Create multiple custom map layers in Mapbox that you can toggle on and off in Tableau


Yes, this is another Allan Walker and DataBlick co-production.  It is also based on the work of the amazing and talented Craig Bloodworth who figured out how to incorporate Mapbox in Tableau and graciously gave my first .tms file.  Allan and I worked on many aspects of the project together and this is a joint post with half on DataBlick, focusing on the maps, and the other on his blog, focusing on sentiment analysis and using Voice Control.

If you haven't already, please start with the post,

This adds onto the Mapbox customization for Tableau by showing you how to:

  • Import custom shapefiles
  • Edit them in QGIS (optional)
  • Style them in Mapbox
  • Add them to a Tableau .tms so you can toggle them on and off in many combinations to help your visual analysis.

If you want to click along and learn, please download the latest version of Mapbox Studio at  You will need a Mapbox account.  Warning, you will probably want to be able to have multiple maps as this point and might need a paid account which is about 5$ a month.  I find it better than shoe shopping, so I am up to the 50$ a month account.  My new guilty pleasure!

Optional, download QGIS if you want to get fancy with your own shapefiles.

The final viz, “Finding Love on Twitter” was created as an  excuse to showcase how multiple map layers created in Mapbox for use in Tableau, and the ability to toggle them on and off.  It was for a presentation at the SFTUG graciously hosted by Daniel Seisun and the kind folks at Twitter.

We each seem to have a different take on how this project got started.  You can read what "he said", or you can just believe me ;-P.  It shows a fun contrast and collaboration of how we each came into the project and how we egg each other on.

In response to Allan's intro:

Really? That's how it went down?  So don't remember that at all, but I was on my 2nd Manhattan and a few shots of some bizarre moonshine that Noah and Joe had brought.

I recall feeling a bit bitter about the topic of "love".  I wanted to capture the tweets for things that were both about love on Valentines day, and then of course what someone who was anti-Valentines might tweet.  #Love vs #Hate or #Sex (not sure what the “opposite” is), #Champagne vs #Whiskey (or #beer), etc. It would all culminate in a horrific R. Crumb'esc commentary / viz.  I was particularly excited about a Mapbox style called “Pencil” that would be perfect.

Screen Shot 2015-04-13 at 10.05.05 PM

Smack down data design lesson 1.  Wait for the data to tell the story and determine the design, not the design to determine the story.

As usual, Allan sprang into action, and about 5 whole minutes later had set up pulls of tweets on various hashtags to be archived in google spreadsheet by hashtag.  Set it and forget it, right?

Well some time goes by, and it is actually getting to be close to Valentines day, and so I go to check on the “crock pot” Google sheets that have been supposedly simmering and getting juicy with love tweets, only to find that the volume and content of Geo-tagged tweets is best to be described a “Meh”.   There is no "bitter" to be displayed in all of it’s glory.  There are like 100 tweets and they are all really, really boring.

I am presenting at an upcoming SFTUG at Twitter on creating Mapbox maps for use in Tableau.  If anyone can help get me “tweets of #love”, surely Twitter can!  And graciously they agree to!  Thank you Daniel!  By now though, I am not so bitter, and also am kind of embarrassed to ask for tweets on  things like #sex and #whiskey and decide that maybe just looking at #love would be good.  But of course I want to use a Mapbox map of the world, and the world doesn't only tweet in #love to talk about love.  So of course Allan produces a list of words used for love in the top 20 languages used in the world in under 2 seconds flat, and it is off to the kind folks at Twitter. 

Super excited!  Twitter data from the fire-hose!!!!!!  There “got to be gold in them tweets”!

Sadly no, still “Meh”.  At best we created an Esty’s like cartoon of love raining down by country.  Most of the tweets were actually for free giveaways and contests.

Screen Shot 2015-04-15 at 4.43.57 PM

Exploring all the tweets, the most are for @IntelJapan and @IloveHQ for a giveaway contest.  Super romantic, right?  I did love looking for the haters, since Allan added a bunch of Sentiment Analysis courtesy of Semantria.

Screen Shot 2015-04-15 at 4.56.08 PM

Well, I still have to present at the SFTUG and I still am committed to making the data about #love on Twitter, so when the data fails you, whip out your design card and put some lipstick on it…  The resulting concept was to use the Twitter data to create an App to help me "Find Love on Twitter".  

Lesson 2, even though you make it pretty, if the data is boring, the viz ain’t gonna sing.

In #love with my new Mapbox skills, I wanted to take them to the next level by being able to not just customize their existing fabulous, out of the box styles, but add my own layers, layer then on top of one another, and be able to turn them on and off in Tableau.  You might want to do something similar to add congressional districts, agricultural land plots, etc.  My example is a bit more silly, but the process is the same.

My design inspiration.  I had just been to the Keith Haring exhibit at the deYoung and really enjoyed this painting:


“The TV monster and the helpless man.”   Haring’s figures are captives and victims of forces they may have created but no longer control.  I kind of really liked this messaging and aesthetic applied to a concept of online dating based on social media data and decided to create my “Finding Love on Twitter” viz with a similar aesthetic. 

Now come click along and get to some map making!

Starting with the Mapbox Style “High Contrast”, I set out to create the background map for my #love viz.   If you want more information on custom map styling, using a pre-defined map source in Mapbox, please refer to my previous post at

If I was really going to create a faux viz “app” that I would use to find #love based on Twitter data, I needed to stretch the ridiculous that much more.  I wanted to be able to add other geodata to the mix to show off my new custom Mapbox layers skills, and came up with the idea of being able to turn on and off MUNI railway lines, because I could obviously only look for love if someone lived near public transportation, and also to create shape files of neighborhoods that I would not consider finding love in.  Sorry Marina boys.

A very simplified description of map making is to think that everything for the most part is either a points, lines or shape (polygon), and you style each and then put them all together to make a map.  To style them in Mapbox you use CartoCSS which is very similar to styling a web page.  An example would be:

#layer {

  line-color: red;

  line-width: 2;


Where the #layer is the name of a layer, for example streets, and the style of the lines in that street layer are a red line with a width of 2 pixels.

Let’s go find some shapefiles layers to import. 

Thankfully there are many free shapefiles out there to take advantage of, such as a google search showing a ton of shapeless for San Francisco.  I usually use this site:

Your downloaded files will most likely be in a folder that contains 5 files.  These files have the same name, but different extensions.  You will need them all, and they need to be zipped in one file to import to Mapbox.

Optional QGIS Step:

To look at, and play with my newly found shapefiles, I use an open source tool called QGIS.  If you need to, once you import your shapefiles, you can edit them so they are are just how you want them to be.   To do this, start a new project and from the "Layers" menu, select "Add Vector Layer.

Screen Shot 2015-04-15 at 5.57.07 PM

You should now see your shapefiles

Screen Shot 2015-04-15 at 5.54.20 PM

In my example, I wanted to be able to have a layer of neighborhoods where I would not consider dating be a map layer that I could turn on and off in Tableau.  As such, I only wanted to keep bad neighborhoods, and delete good ones.  This is not necessary before importing them into Mapbox, but it is also a great way to see any other attributes associated with the shapefiles like links to other information, attributes that group them together, or just plain see if what you downloaded was actually what you wanted.  You can also create your own shapes if you like, or add attributes to existing ones.

Screen Shot 2015-04-15 at 6.00.19 PM

Here is the updated map with only the neighborhoods that "I won't date in".

Screen Shot 2015-04-15 at 6.05.25 PM

Once you are finished editing your layers, select the “Layers” menu and then “save as”, and give your new shapefiles a name.   

Screen Shot 2015-04-15 at 6.07.17 PM

Go to where they are saved and zip the folder that contains your new files.  The must be zipped for importing into Mapbox.

End of Optional Step and back to Mapbox

Go to and login to your account.  Click on “Data” in the upper left corner.  Then click on the “upload” button, so we can upload your data to Mapbox.  00

Browse to the file on your computer and upload it.  It will take a few moments to process the upload.  Once it is uploaded, click on the little copy icon to the right of the ID of your new data file.


In Mapbox Studio on the lower left corner, click on “Projects” and then “Create New”.  

Screen Shot 2015-04-16 at 7.14.56 AM

Instead of picking one of their predefined styles, we will scroll down and use our newly created and uploaded source.   Use “Paste” to paste the ID and hit “Create”. 

Screen Shot 2015-04-16 at 7.26.22 AM

Oh, no?  Where did my shapes go?  Remember I was using San Francisco, and this showing a map of the world, so we need to search for SF, buy using the looking glass in the upper left corner.

Screen Shot 2015-04-16 at 7.28.39 AM

Type in San Francisco, and a few results come back.  Select San Francisco, California, and then click on the looking glass again to hide it.  You should now see our San Francisco Neighborhoods.   Note your shapes may look different than mine if you did not use the Optional QGIS step to delete certain neighborhoods.  Either way, you will see a bunch of outlines of SF neighborhoods in Mapbox Studio and an area to the right where you can style them.

Screen Shot 2015-04-16 at 7.36.13 AMMake a simple change, like changing the color of the outline of the shapes by clicking on the small button to the right of “line-color” and picking a new color.  Alternately, you could just type in the color Hex value if you know what color you want.  You have to click “Save” in the upper right corner to see the change you just made.  Note, when you hit Save, your project is now saved with a new Folder on your local machine with the extension “.tm2source”.  This is where all the assets that make up your layer are stored. Screen Shot 2015-04-16 at 7.36.30 AM

Back to your map layer, these are actually polygons, so we can fill them with a color if we like too.    For example, you could add the following to fill the shapes with hot pink.  You must hit "Save" to see any changes.

#sfbadhoods {

  line-width: 1;

  line-color: rgba(14, 5, 5, 0.5);

polygon-fill: #fd10cf;


If you want more information on styling your map elements, Mapbox has an online tutorial that walks through different options, or you can try anything that you might do using normal css formatting.  For the most part they work here too!  Go ahead..  “maps gone wild” time!  However, if you want to be lazy (it’s okay!) just use my style.

Hoods Style

Map {

/// background-color: #fff;


#SFNeighborhoods {

  line-width: 3;

  line-color: #000000;

  //polygon-fill: #d444dd;

// polygon-opacity: 0.4;


Screen Shot 2015-04-16 at 7.58.28 AM

As I mentioned before, I wanted to make my Viz have the aesthetic of that Keith Haring painting, so I wanted to fill the polygons with some of his art.  To fill a polygon with a pattern or image you would using the following code which should point to an image file that you saved in your “My Project”.tm2source folder.  I used an image of a painting and referenced it as below after putting in my tm2source folder:

polygon-pattern-file: url(“/badhood.png");

Hit “Save” again, and you should now see the polygons filled with the painting.  Sweet!

Screen Shot 2015-04-16 at 7.58.38 AM 0

Once you have your layer styled the way you want it, then you need to upload it to Mapbox.  Click on “Settings”, and then Upload to Mapbox”.  Copy the ID that it returns, you will need this for your .tms file that Tableau will point to. 

Now go ahead and have some fun.  Add a few more shape layers, such as MUNI lines, water, bike lanes, police stations, whatever your heart desires.  I’ll wait for you…..

For this exercise, you may want to add a basic map to put these layers on top of, so go ahead and create a new project in Mapbox Studio, based it on one of their predefined styles and upload it to your account and copy the ID or just use the one that you made when you followed my previous post  because of course you did that, right?

Are you ready?  You should now have at least 2 layers, the one you created based on an existing Mapbox style, and the one(s) you created with your own shapefiles.  Let’s get these layers into Tableau!

Creating a .tms with multiple layers

We are now going to create a .tms file to add to our map sources.    Here is an example of a .tms with just one layer.  The .tms file is just a little xml and can be edited in any text editor of your choice.  On windows I use Notepad ++ and on the Mac I use Sublime Text.

Screen Shot 2015-04-16 at 8.09.04 AM

The access_token is just your Mapbox ID and all the references to datablick.XXXXXXXXX are just pointing to your layer id in Mapbox.  How and what to change is explained in great detail in my previous post, so I wont go into that here.

The .tms with a multiple layers is not that much different.  There are really only 4 areas that need “find and replacing”, and you can easily add and delete more or fewer layers, but the basics are the same.  The order of the layers will determine which one is on top in the stacking order, so the top layer should be at the bottom of the list.

multiple layers (1)

  1. Replace the access_token key with your personal one from you account.
  2. Give each of your layers a name that you will use to turn it off and on in Tableau.
  3. Find and replace Map ID’s with yours
  4. Give a name to your fabulous group of layers

Now save it as a .tms file with a descriptive name, and put it in your c:\Documents\MyTableau Repository\Mapsources folder.

If you have Tableau open, then you need to close it and reopen it.

Build a basic viz that uses some location information.  I am of course going to use my Twitter, Tweets of Love data.  Use SuperStore if you want!  Just make sure it has some SF data.  Pick something like “Zip” and “Sales” and click “Show Me” to see it on a map.  Now go up to the “Map” menu and select “Background Maps” and then the name that you saved your .tms file as.

Screen Shot 2015-04-16 at 10.17.53 PM

Go back to the “Map” menu and select “Map Options”.  On the left you will see the new layers you just added.  Toggle them on and off.  Each worksheet you have can have a different combination of the layers, or all the layers.  How fun is that!   Here is my map with the "Keith Haring" , MUNI and Neighborhoods layers.

Screen Shot 2015-04-16 at 10.18.05 PM

Here is my map with just the "Keith Haring" background map.

Screen Shot 2015-04-16 at 10.18.12 PM

Here is my map with the "SF MUNI" layer, making it much easier for me to see Tweets of Love that came from folks that are near a MUNI line.

Screen Shot 2015-04-16 at 10.18.27 PM

Here is my map with the "Hoods I won't date in" layer, making it much easier for me to see Tweets of Love that are from folks in places I will go.  I was tempted to change my mind for him, because a day at the beach did sound kind of romantic.

Screen Shot 2015-04-16 at 10.18.44 PM

But then of course I found the Tweet that could only have come from my True Love (found using Twitter data).

Screen Shot 2015-04-16 at 10.18.57 PM

That’s all folks!  Have fun with custom map layers via Mapbox in Tableau!

Now back to Allan's blog post.  For the SFTUG, we decided to spice things up a bit and make my finding True Love using Twitter data a bit easier by adding Voice Control to the Viz.

Note - if you ever thought you didn’t do code, you do now girlfriend!  You just edited CSS and XML.  Congrats!  Go treat yourself to a little something something.

Fast and Fabulous Custom Maps using Mapbox in Tableau


So the last time I wanted a custom map, I ended up building my own WMS and spending months and $’s to get the map I wanted.  If you followed that advice - good for you. You and I can now drink at at Tableau conference and tell the young’ins about how we used to have to walk uphill in the snow, wearing only flip flops and a Magnum BI t-shirt, while being pelted with popsicles to get our maps. Then one day recently, I had a cocktail with Allan Walker (that insane mapping Zen dude) who pointed out that if you just opened up a .tms file in notepad, there just wasn’t all that much to it but a wee bit of xml. Thank you again Allan.

A little side note from Allan before we begin:

"Craig Bloodworth of The Information Lab and I spent some time investigating and customizing the Tableau "TMS" file.  While I concentrated on delivering ESRI & Stamen basemaps, Craig took on Mapbox."

What follows is another DataBlick and Allan Walker and Craig Bloodworth bit of fun with maps.

Onto new, fast and fabulous. Seriously, this is gonna rock your Tableau map world. Go to and scroll down to the Mabox Studio section.

go to map

Download and open Mapbox Studio. Once open, click on Start a New Project.

Click to start a new project


You will be able to select from a bunch of great vector types with different map styles to use as the base layer for your map. You could also start from scratch, but this is all about getting to fabulous fast! For this tutorial, I a going to pick “high contrast”, but feel free to select whatever you like.

Pick from some amazing vector tile base maps


Once you have selected the base you can use the looking glass to search for a city or area that may be of interest by typing it in the search box. I of course will be using my favorite city, San Francisco.

Zoom into SF on Mapbox


Now notice all of the lines of “css - like” code to the right of the map view?  At this point Allan of course says, "make it black".  Because as you all may know, every map he makes is all "Johnny Cash" black...


Now before going any further, make yourself a snack and open a bottle of wine, because this is where the fun begins. You may very well find yourself sucked into playing with your new map super powers for hours. Click on a little circle that has color it it. Pick a good one, like water or land. Go on, make them hot pink. Now hit the save button in the upper left corner of the screen. Notice the map update right away. You can also just enter a hex code for the colors if you need an exact match. Play, play play!

I of course am going to use the colors from my SF Giants, and got the exact colors from a fun site called

pick you favorite team hex colors

You can change fonts, colors, line opacity, thickness, etc. and also do it for different levels of zooming in and out. One helpful hint is to copy all the code and paste it in TextEdit so you have a backup incase you mess up. You can also type " //" at the beginning of a line to comment things out and test what it looks like before you delete them.

So by now a few hours have probably gone by and you have something fun like my SF Giants map style.

Mapbox styles like SF Giants

Time to upload your work of art so that you can use it in Tableau. Click on the Setting button on the upper left corner, and then Upload to Mapbox. After you click on Upload you will notice that right above where you clicked there is now a Map ID. This will have your username, plus a bunch of letters and numbers after it. Copy and past that in a TextEdit file for use in a minute. Click on that MapID and you should be taken to

click to upload your new style to map box

Notice the API Access token at the top. Copy and paste that into the same TextEdit as your Map ID.


Now open up the sample.tms file below, and copy and past it into a TextEdit file.


NOTE!  On the second line where is says version 8.2, please update to 9.0 0r whatever version of Tableau you are using.

Using copy and paste, put your access token in place of the one in the .tms file (red box).

change access token


Also give your map a fun name in the two map display name areas so you recognize it in Tableau.

display name


Then use “Find and Replace” to update all the Map ID’s to use yours.
replace map id's
If you are planning on publishing to Tableau Public or server, change the "false" to "true"

Lastly, if you are feeling extra naught (as you have had that bottle of wine by now, right?) put something clever in the map-attribution text section.

change attribution

Save your .tms file with a new name. This will be the name that you will see in Tableau so make it descriptive. Place this file in your c:\Documents\MyTableau Repository\Mapsources folder.

add to your map sources folder

You will have to restart Tableau. After it restarts, open a workbook that had some Geo fields in it, like SuperStore and create a sheet with that data on it. Go up to the Map menu, and then select Background Maps. You should see the new .tms you just made. You totally made a Giants one too right?

select your new tms file

Wait? Where’s my awesome map? To see it, you have to select the Map menu again, and then select Map Options. Then select the Map Layer with you Map’s name.

click to show your map layer

There it is! Your own custom background map .tms in Tableau.

your tms in Tableau

Zoom in, pan around. Enjoy! You now know where the folks that shop at SuperStore live, and that they are Giants Fans!

zoom in and pan on your map

Stay tuned for the next post.... map layers you can turn on and off at will. Maybe get a case of beer for playing with that one.

This Story Starts with an Irresistible Map


First there was a challenge. My cousin Margaret invited me to climb the very tall "Triple Nickel" in San Francisco - 52 flights of stairs - for a fundraiser to benefit the American Lung association called the Fight for Air Climb. Worthy cause! Worthy challenge!  (donate if you can).  Well of course the most appropriate way to train for the event was to spend all my time on data viz.

Stairs, the City… my city.  I used to climb up stairs from the Castro to Noe Valley weekly just to get to my favorite cheese store,  drink late at night at the top of the stairs on Sanchez Street and look at the lights of the city (and dream, drink, curse, kiss), walk my dog when he was a wee Husky pup up the Montalvo stairs just to try to wear out his energy,  crashed on a motorcycle on one of the steepest grades in the city and had to walk bleeding down the  22nd Street steps.  If you went on these Stairway Walks in San Francisco these stairs would tell you tales… they would tell you the Tales of the City.  I need a viz that wasn't just about the climbing stairs, but about how the stairs are characters of the city as well.

When the Giants won the 2010 World Series, my friend Amy Charles got a Dave Eggers poster that captured the fans he encountered during the series and what it meant to them, their stories.  Borrowing from this style I spent a lot of time gathering stories that people had posted about each of the stairways on Yelp, and other blogs.  Hover over a stairway and in many cases you can see random stories.  My favorite is for Baker Beach….

Then a real live pink pony with a glittering, rainbow tail and mane, that fit in my purse,  appeared.  "Daddy I one of those, NOW", I said, channeling my best Veruka Salt.


I wanted a Stamen style map in my Viz!  No problem actually, as I could easily design it and export it as an image.  Then I could just use it as background image in Tableau after assigning some Lat, Long coordinates to it.  Viz done… booyah!

Wait, I can't drill into the map and zoom and stuff?

Captains Log… Feb. 6th.  Love the look of my knock off from China town.  I think Shrimp Boy may have had a hand in it even, but I want a real pink pony...

And the adventure began:

Feb. 7th  Your New MapQuest Developer Network Account

Feb. 13th Open Street Map 

Feb 28th  Google Maps Gallery

March 4th  Mapbox and TileMill

March 5th Allan Walker - help…..!  ? "Since you are the king of Tableau Maps, I wanted to see if you had any suggestions?"