Linear Geometry Spatial Files in Tableau: Simple as 1-2-3

Tableau just released version 10.4 and with it came some great new features. Dashboard spacing will be so much easier with the ability to control padding and collabortation with discussions around visualizations has been added to Tableau Server. One of these new features added in 10.2 was the ability to connect directly to spatial files, but this was limited to polygons and points. Now with 10.4, you can connect directly to spatial files that are lines and the Tableau community has been having lots of fun with this.

Bridget Cogley mapped the roads in Ohio and Jonathan Trajkovic mapped the roads of Paris. Joshua Milligan mapped the US Railways and Andy Kriebel mapped all of the roads across America and the London bus routes. And these are just a few of the many visualizations that have poppped up in only a few days of this feature being released.

So why are people having so much fun with this new feature? For one, it's opened up access to new data sets that have been available, but we haven't been able to use in this manner. In addition, it's super simple to do. We can create these maps with three simple steps. Find the data, load the data and double-click.

Below is a visualization of all of the rivers and streams for the Continental U.S. using these simple steps.

Creating Maps with the New Linear Geometry Feature

Step 1: Find a Linear Spatial File (Shapefiles)

"Shapefiles" are maps stored in a vector format which stores location, shape and attribute information. Start with a Google for some shapefiles, for example, "shapefiles U.S. rivers". You'll quickly see that these are pretty easy to find. The top two results here and here offer a download of the shapefiles.

Download a shapefile and unzip it if it's compressed. You will be surprised at how many of these files are available. For example, here in Cincinnati (Ohio), Hamilton County offers a portal filled with GIS Layers (shapefiles for download). Check out all of the data available on the Cincinnati Area Geographic Information System (CAGIS) portal. This portal inclused shapefiles for parcels, buildings, pavement, parking, railroads, sidewalks, rivers, streams, flood zones and even street centerlines.

Step 2: Load the Shapefile in Tableau

Select Data from the top menu and New Data Source. Select Spatial File and pick the shapefile that you want to load into Tableau. Shapefiles will have the file extenion .shp. This will load the data into Tableau and you should be ready to create your visualization. Click on Sheet 1 and you will be off to the races.

Step 3: Build the Visualization

This is the easiest step of all. When Tableau added the ability to import shapefiles, it added a Geographic field called Geometry. You will notice there is a little globe next to this field. Simply double-click this field and you will have a map. Tableau will put Longitude (generated) on the Columns and Latitude (generated) on the Rows and COLLECT (Geometry) on the Details. You just created a map of the lines with one double-click of a mouse.

The lines will map as one large object, which may not be ideal depending on the data and the purpose of the visualization. Most of the time there will be some sort of Object ID field in the data. If there is, make sure Tableau picked it up as a Dimension. If it did not, simply move it by dragging it from Measures to Dimensions. Then add it to Details on the Marks Card. Add other fields to Details or Tooltips as needed.

Following these simple steps, here is a map of the sidewalks in my neiborhood.

I think you will agree that the steps are super simple and now you can join in on all the fun that the Tableau community is having visualizing these new shapefiles.

I hope you find this information useful. If you have any questions feel free to email me at Jeff@DataPlusScience.com

Jeffrey A. Shaffer

Follow on Twitter @HighVizAbility