If you’ve played with Tableau’s new spatial data connector, you might have come across an error like this:
or even this:
The first error message will pop up if you try to connect to a spatial file containing lines and the second when your spatial file contains more than one feature type. Geographic features can be polygons, lines or points. At the time of this writing, Tableau can connect to spatial files containing either polygons or points but not both in the same file. I don’t know if/when Tableau is planning to support mixed geometry spatial files but support for lines is a high priority item and is coming soon. Hear Tableau developers addressing one user’s question about line support:
But until then, we can always import line geography to Tableau the “old-fashioned way” like we used to do before Tableau 10.2. There are at least 4 ways to do this:
- FME’s Shapefile to TDE online converter
- Alteryx Tableau Shapefile to Polygon Converter written by Craig Bloodworth
- shapetotab utility developed years ago by Richard Leeke
- Buffering the lines in a GIS software like QGIS, as described by Adam Crahen
I’ve found that the easiest method is using FME’s online converter. Go to https://www.safe.com/free-tools/shapefile-to-tableau/
Just drag and drop your files into the conversion window. Shapefiles consist of several files and they are usually available for download as a ZIP archive. You don’t even have to unzip it, just drop it in. Press the Convert Now button and in a few seconds you will get a prompt to download the resulting Tableau extract. And if your archive contains multiple shapefiles, the FME converter will automatically convert all of them!
I used the converter to make a Tableau extract of streets of Vancouver, based on a shapefile downloaded from Vancouver’s Data Catalog.
After connecting to the extract you will see that FME converter created 2 custom measures: spatial_latitude and spatial_longitude and 2 custom dimensions: spatial_geometry_id and spatial_geometry_order.
Drop spatial_latitude and spatial_longitude onto the canvas;
Switch Marks to Line;
Put spatial_geometry_id on Detail, and
Put spatial_geometry_id on Path.
A little bit of formatting and our map is ready: