It turns out that someone is actually reading these blog entries and has sent me a question... what if I want base map tiles underneath my fancy projected dataset?   In the first few posts in this mini-series, I suggested that you just make the Tableau map tiles transparent so that you don't give away the secrets of the coordinates in your data.  If you want to put in a little more effort (and read a longer blog post), you can have custom base map tiles to match your newly projected data.  All it takes is a little ingenuity, more creative lying with spatial data, and a Mapbox account.  And then magical projected maps with custom basemap context can be yours...

1-polarMap_BaseMap.png instead of polar_no_basemap.jpg



Side note: my polar data exploration was encouraged by Alan Eldridge and I wrote a short form write-up on his blog – but here is the painfully detailed version



The basic details - if you want to skip the instructions:

  • Prepare your data for Tableau (see Parts II and III): project into your coordinate system of choice and then lie and say that the data is Web Mercator. All done.
  • Prepare your data for Mapbox tiles: project into your coordinate system of choice, lie and say the data is in Web Mercator, convert back to WGS84 (latitude and longitude), add to blank Mapbox tileset. 
  • Add your data into Tableau, make a map.  Add the Mapbox tiles.  Shake or stir as needed.  Garnish with good tool tips.  Sip and enjoy.


I’m going to use polar data for the example below, which is one of the harder geographies to work with since the poles don’t technically exist in Web Mercator (the projection cuts off at ~85°).  Even though I’m working with polar data, the general ideas should work for any region.  


Ingredients needed:

  • A few different spatial data files (these could be Shapefile, JSON, etc.)
    • The file for the data you'll interact with in Tableau (I'm using polar sea ice data from NSIDC - you can go straight to the FTP archive here)
    • Any vector datasets that you want for context in your base map (I’m using country outlines from ThematicMapping)
    • Any georeferenced imagery that you want for context in your base map (I’m using a polar geoTIFF from IBCSO)


  • QGIS– a FREE and open-source Geographic Information System (or you can use whatever GIS, database, programming language, or other tool you prefer for manipulating spatial data…there are plenty of options)



Some of the usual caveats with any of this projection alteration work:

  • With the projection trick that I've showed you in earlier posts, you will need to make the Tableau basemap fully transparent (it has to disappear) or make your own custom tiles in Mapbox.


  • Working with polar data is a pain in the ****, but I’m going to write fairly long and detailed instructions. If you’re not dealing with polar data, it is the same set of steps, but should be a little easier (less data cleaning needed)


Here we go:


Make the data for Tableau - re-hashing the details we went through in Part II of these posts


First, do a little homework. Read the earlier blog posts (Part I (projection basics) and/or Part II (data manipulation)) to understand the tricks of how to make Tableau think that a projected dataset is really Web Mercator.  Our process to get the polar data into Tableau will be a little easier than the earlier examples since the dataset from NSIDC already has an appropriate projection (NSIDC Sea Ice Polar Stereographic South), but the data for the map tiles will require a little more work.


Option 1 - The I love to do everything with GIS method: Use QGIS to change the layer properties so that the file thinks it is Web Mercator, and then 'save as...' to make a new copy of the dataset so that the projection information is permanently saved with the new shapefile.



Option 2 - The lazy cartographers method: For data that is already in the projection you want, just replace the text defining the projection. How? A shapefile will often have a file that explicitly defines the coordinate system for the data; this file has the extension 'prj'. 


This is just a text file, so you can edit it with any text editor (I like Sublime, but Notepad or whatever you prefer should be just fine).  For my sea ice dataset, the prj file contents look like this - "mumble mumble, sea ice polar stereographic, mumble mumble, whatever datum / earth model is being used, mumble mumble", or:


PROJCS["NSIDC_Sea_Ice_Polar_Stereographic_South",GEOGCS["GCS_Unspecified datum based upon the Hughes 1980 ellipsoid",DATUM["D_Hughes_1980",SPHEROID["Hughes_1980",6378273,298.279411123064]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Stereographic_South_Pole"],PARAMETER["standard_parallel_1",-70],PARAMETER["central_meridian",0],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["Meter",1]]


This tells a GIS (or Tableau) how to project and draw this data appropriately.  Since we want Tableau to think that the data is Web Mercator, we can really just open the text, and swap out the original projection information and replace it with the details for Web Mercator (conveniently available from, or you can just copy/paste from below).  No QGIS needed here, because we don't want to re-project, we just want to tell a little lie about the projection.


PROJCS["WGS 84 / Pseudo-Mercator",GEOGCS["Popular Visualisation CRS",DATUM["D_Popular_Visualisation_Datum",SPHEROID["Popular_Visualisation_Sphere",6378137,0]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Mercator"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["Meter",1]]


Now you should have a dataset that you can bring directly into Tableau.


That about covers it for the review of the earlier parts of this series.  Now we're going to get fancy!


Make a new base map!  (The new stuff!!)


First – figure out what data you want in your basemap

I’m going to make a really basic map for the polar data, but with Mapbox you can add as many layers of detail as you want (e.g., roads, buildings, counties, provinces, labeling, etc.) – you just have to have the data for whatever you want to show up on your fancy, projected basemap. 


Collect and process the base map data.  Since we are making our own custom map tiles that aren’t in Web Mercator, we can’t use the built in data in Mapbox (or Tableau).  This means that we have to dig up and process whatever data we want to show up on the base map tiles.  I’m going to keep it simple here to show the basics:


Polygons – we’ll use countries of the world

Imagery – we’ll use a geoTIFF (geographically registered TIFF)


Here are the basics: We need to get both datasets into a Polar Stereographic projection, and then ‘changed’ to Web Mercator (not reprojected, just using our little white lie skillz to make them think they are in Web Mercator) -  just like we did in Parts II and III of these posts.


The countries dataset from is in WGS84 coordinates (World Geodetic Survey of 1984).  So in QGIS, we need to do a Save As… and project to Polar Stereographic:



Then we change the projection in the datasets Properties in QGIS so that it thinks that it’s in Web Mercator.

crs_properties_to_WM.png  To keep your data clean - you want to make sure that it is clear that this is a dataset with incorrect projection information (remember, you lied and said that this file is in Web Mercator, when it's really Polar Stereographic), so go ahead and right click and 'save as...' to make a new file with a name that makes it clear that this has bogus projection information.


Now if we open a new QGIS project and add the newly saved file in, it should look like this:


  It isn’t common to use a polar stereographic projection for the entire world and the distortion around the periphery is crazy.  Fortunately, we just need the center bit for our map.


Since we only need the center bit, we’re going to delete all of the extra countries.  If you had great dreams of having all of the countries in your base map, I’m going to crush that dream right now, and save you the step of trying it out yourself. Here is what the new dataset looks like when you do the last step of converting back to latitude and longitude coordinates (so that you can put it into your Mapbox tiles)…I left an a copy of the dataset in the original Polar Stereographic for reference:



Whaaa?  Let’s just say the math does not treat this data well when we try to use the inverse Web Mercator equations to translate polar stereographic coordinates to latitude and longitude.


Easy way to fix this problem – do some house cleaning and delete the countries on the periphery before converting back to latitude and longitude. 


To do this, click on the pencil icon in QGIS (Toggle editing) – the countries should now have a bunch of red x marks along the edges; these mark the vertices.  Using the select features by area tool (yellow box with an arrow on it), select everything except for bits of Africa, Australia, and South America and hit delete. I like to delete in phases so that I don’t accidentally remove part of the map that I want.  When you’re done, just click on the pencil icon again and save edits.



Now, save a new copy of the dataset and change the coordinate system to WGS84 (World Geodetic Survey of 1984) so that we can drop it in Mapbox.  This will use the inverse equations to go from Web Mercator coordinates back to latitude and longitude...this keeps our polar data centered around (0,0), instead of putting it back at the poles.



If you have imagery data that you want in your basemap as well – like a geoTIFF – just follow the same steps:

  • Use QGIS to put into the projection of choice (most polar data is already in the right projection)
  • Change the projection definition to Web Mercator
  • Re-project to WGS84
  • Note that raster (imagery) reprojection is a harder beast than dealing with vector coordinates, so your mileage may vary on the results (e.g., your imagery may get a little blurry).  If you want to understand this problem well, I recommend some of the fine raster re-projection work by the Center of Excellence for Geospatial Information Science (CEGIS)


Push the data to Mapbox

Go to the Mapbox web site.  Log in or create a new account.


Go into Mapbox Studio.   Add new tilesets with whatever data you want in your basemap. My example uses a tileset for the simplified countries and the geoTIFF that I reprojected.



Add a new tileset with a ZIPPED copy of all of the files for your countries data (a shapefile is really 3 or more files – put all of files with the same name, but different file extensions (shp, shx, prj, dbf, etc. into your zip file).  The five files that I used and the resulting zip file that I used in Mapbox are shown below:



Then add another new tileset using your GeoTIFF data. 


Add your tilesets to a new basemap

Switch over to ‘Styles’ and create a new style:


Use the Empty map style for your template:



Add new layers for the country outlines and imagery:


Adjust the styling until you are happy. There are lots of instructions available for this – so instead of making this post even longer, I’ll point you to the Mapbox Studio manual or Mapbox Studio Tutorials and Examples


If you add the image tileset in Mapbox Studio and it doesn’t show up, try zooming in and out on the view.  Sometimes the zoom level for imagery isn’t right for your needs and it has to be adjusted so that the image shows up when you want it.  If you have problems, here are some details from Mapbox on how to adjust the zoom level.   For my polar base map tiles, I used Mapbox Studio Classic and set the minimum zoom level to 1, so the image would always show up, regardless of zoom level in Tableau.


When you’ve adjusted the styling of your base map to your liking – click on Publish and when given the option, select Preview, develop, & use.


Copy the code for using it in Tableau. 



Finally, make your Tableau map

  • Add your polar shapefile (just adding the data source in Tableau) and draw the geometry
  • Change the base map (Map -> Background Maps -> Map Services)
    • Add -> Mapbox Maps
    • Paste in the special string of text that you copied from Mapbox in the URL textbox
    • When you paste the code in the URL textbox, the API Access Token, Username, and LayerID should be automatically populated.
    • Give the Style a name – and click okay




You should have a beautiful new map – complete with imagery and whatever reference geography details you added in in Mapbox.



If you made it this far, pat yourself on the back! When you make some killer awesome fancy maps in Tableau let me know…or if these instructions just totally stump you, let me know and I’ll see what I can do to help out.  There are probably many examples where these cheats just won’t work, or don’t quite do what you need.  That is just going to happen when you’re working with the weirdness of map projections.