Sign in or start a free trial to avail of this feature.
8. Adding Spatial Files to Tableau
Spatial files are very detailed polygon maps, often created by governmental bodies. In this lesson, we will learn how to import and manipulate spatial files in Tableau.
Adding spatial files
- Spatial files can appear in many different formats (KML, Shape files etc.)
- Tableau 10.2 does a very good job of easily integrating these files into the view
- Once the spatial file has been imported, it's important to set the Level of Detail
- To interact with external datasets, simply create a relationship between the relevant columns
- This will enable you to overlay population data and even sales data on top polygons
- [Instructor] As I mentioned in the previous lesson, many detailed polygon maps such as the map of London boroughs shown on screen are available in pre-created formats that can be imported into Tableau. There are many different spatial file formats such as KML, ESRI, and shape files but thankfully from Tableau version 10.2 onwards the software makes a very good effort at importing almost all of these files quite smoothly. Most of these pre-created spatial files are built by governments and on the web page shown on screen, you have a number of very good public data sources that you can practice with. Off camera I've downloaded the spatial files for the London election wards and boroughs. The spatial file here is called a shape file with the .shp extension. Let's now add our shape file to a map. To do this, I can simply take the geometry measure and add to detail and this pre-populates the map with all of my different polygons. However, I now need to set a level of detail and here I'm going to go with Borough.
And when I do this, I can scroll over individual boroughs and they are highlighted.
To make individual boroughs easier to see, I might want to add a color code.
And now each individual borough is much easier to make out. Normally, I'll want to add a measure to my map, so I can compare boroughs against a particular metric. For example, land area. To compare land area, I'll remove borough from color and add hectares and I now have a color code based on the amount of land that each borough has. However, this is not incredibly valuable because it's pretty intuitive from the map itself to see which boroughs have the most or least amount of land. What would be more interesting would be to see the population of each borough and to do this I'm going to add a separate dataset called Population by Borough and in Population by Borough I simply have a list of the boroughs and the population of each one, so I can simply create a relationship on that column between the two datasets.
So, I go to Data, add our relationships, add and connect borough to area and then press OK and OK again. And I'll now remove hectares from the color code and instead I'll add population and as you can see, we now have each borough included with its population with its population acting as the color code. In most cases when you're using spatial files you will often have an external dataset that contains information such as population that you will want to join to your spatial files. This could be sales revenue, pricing information or population as in this example. Simply join or blend the external datasets on a column that contains the name of your specific polygons or regions, in this case boroughs, and then your work is complete. It's almost too easy to create these maps in Tableau where you have detailed regional maps that can combine everyday data that you store in Excel files.