Tableau Geospatial: Polygons, Lines, and Points

Tableau Geospatial: Polygons, Lines, and Points

I am going to write up a series of blog posts on some tricks I learned with Tableau’s spatial file connector.  Hopefully, Pooja will write one or two and help a brother out…:-)


First off, I am not a cartographer or GIS specialist so don’t burn me at the stake if I get something wrong.  But do let me know so I can fix it.

Also, don’t be scared.  This isn’t rocket science, even I can figure some of this out.

Let’s first look at what does a polygon, line or point mean.  Here is a map and legend from Wikipedia.

In this case, the lake is a polygon (or a filled object), the wells are points, and the rivers are lines (or a series of connected points).

So that is pretty straight forward right?


Polygons

It is amazingly simple to connect to SHP and KML files in Tableau.  

Let’s build a polygon map of the land covering the earth.  Go to Open Street Map Data.  Download the simplified Polygons (Large simplified polygons not split, use for zoom level 0-9).  You will be downloading a ZIP file.  Unzip it.

  1. You just pick the new spatial file connector and select the datasource:

2. Go to the sheet and drop the Geometry pill on the marks card.  Tableau will automatically use generated Lat/Long to draw your map.  Kudos to Kent Marten and map devs for making it easy on us!

3. The result above is currently a single polygon.  FID is actually a dimension, not a measure.  I am going to move it to a dimension and drop it on color so you can see the multiple polygons it creates easier.

*Public Service Announcement: Don’t build rainbow maps


Points

Let’s build a point map using John Snow’s famous cholera map.  Go to Robin Wilson’s Blog, who created and made available the Shapefiles for his recreation.  Download the SnowGIS.zip file from the 4th paragraph down.  Unzip it.

Repeat Steps 1 & 2 above.  I connected to the Cholera Deaths shp file.  Drop Geometry on the marks card.  Done.  I am showing this map on a washed out Mapbox High Contrast background for effect.  Don’t know what Mapbox is?  Check out Ryan Sleeper’s post of adding some custom maps to Tableau.


Lines

This is probably why you are still here.  You tried to connect to a line shapefile and you got this error:

Don’t worry, Kent says Tableau is working on it.  🙂  He also gave me a good tip.  Buffer the lines in QGIS.

So here goes.  I am on a mac, if you are on a pc I feel bad.

  1. Download QGIS

2. Open the dmg file.  Read the ReadMe…..if you didn’t uninstall any old versions.

3. The are four pkg files to install.  When you try to run them, it will say it can’t be opened because it is from an unidentified developer.  Open Settings->Security & Privacy and click Open Anyway.  Go ahead be adventurous and repeat that for the four pkg files.

4. Congrats QGIS is installed.  Let’s build a line map in Tableau.  Go to NOAA’s storm prediction center.  Download the torn.zip file under the tornado map.  We are going to map all the tornadoes in the last 65 years.  Don’t steal my idea.  Unzip it.

5. In QGIS, open the layer to take a look at it.

It should look like this:

6.  We are going to buffer the lines.  My non-technical translation is convert the lines to polygons.

Here is what the default dialog box looks like:

Here is what I fumbled around with and changed:

I saved the file in the same directory as the original and added buffer to the filename:

7. Go back to Tableau and connect to your buffered shp file:

Now drop Geometry on the marks card. #BOOM:

I hope that was helpful.  Let me know if I got anything wrong.  Most of this was me googling and fumbling around in the dark.

7 thoughts on “Tableau Geospatial: Polygons, Lines, and Points

  1. Sean Boon

    I got to hand it to Kent. Creating buffers around “lines” so that you can read them as polygons until we ship the support for lines in shapefiles is creative.

  2. Adam Crahen

    I agree. I would not have been able to pull this viz off without that helpful direction! You guys rock!

Leave a Reply