Quick hands-on: Tableau adds shapefile, KML & GeoJSON imports for custom maps

Map created by Tableau 10.2
Credit: Screenshot of map created with Tableau 10.2 (U.S. Census Bureau data)

Tableau has significantly expanded its custom mapping capabilities in version 10.2, allowing for importing your own geospatial files in GeoJSON, shapefile, KML and MapInfo formats. I finally had a chance to take Tableau 10.2's GIS functions for a spin, and it's a welcome addition.

If you're a Tableau user and upgraded to 10.2, you probably noticed that "Spatial file" is now an available data connections. Importing a geospatial file works the same as any other data source -- you pick the file, make a few decisions, and import.

I started with a shapefile of information from the U.S. Census Bureau that had both geometry and data -- somewhat easier than trying to merge geospatial info with a separate data file. I chose median earnings in major occupation categories by Congressional District (and then did some research to determine that column B24021027 was median earnings for Computer and mathematical occupations).

As soon as I dragged and dropped the geometry field onto my main work area, a map of Congressional Districts appeared. It couldn't have been easier. Color-coding that map by median earnings was a bit less intuitive, though. I took care to filter out a "Total for all of the US" row, but no matter how much I dragged, dropped and rearranged, my map stayed a single color.

I finally caved and looked for map-specific instructions on Tableau's website. The solution: Even though the imported file has numerous defined areas, by default those areas are aggregated into a single unit of measure, which is why all your data gets applied to the entire map. You, the user, need to "disaggregate" the polygons by going to the Analysis menu and unchecking "Aggregate Measures." I'm not sure why Tableau engineers thought that defaulting to "treat all polygons in a shapefile as one unit" was a good idea, but it was simple enough to correct once I discovered up the cause.

After that, dealing with geospatial data was pretty much like any other Tableau data source. Joining a geography file with a separate data file is like other joins: You have to make sure the common-column keys use the same format in both files. I find this tends to be particularly challenging with GIS files, since there are so many ways to identify a place. But you can turn to already-existing Tableau tools such as creating new, calculated fields so that one file's joining column matches another. (Still, I tend to be more comfortable doing that kind of data wrangling in a command-line environment such as R).

I didn't try this feature out, but Tableau maps can have more than one layer, such as showing transit routes within cities or counties, strengthening the analysis component for those files.

Bottom line: The ability to import any shapefile into Tableau is a plus for situations like mapping city voting precincts or a company's custom sales districts. Mapping within general BI software probably won't be a substitute for full-fledged GIS software like ArcGIS or QGIS anytime soon if you need very sophisticated spatial calculations and analysis, or mapping capabilities for other interactive applications. However, I can see how this can come in handy (such as last fall, when I volunteered to generate election maps for a friend's blog.)

It looks like mapping will be one of the next areas where data visualization vendors will be competing, particularly after Microsoft partnered with GIS powerhouse Esri to bring some ArcGIS capabilities to Power BI. (As far as I know, you still can't yet import custom shapefiles into Power BI, although many shapefiles are available through Esri public collections). I suspect by the time the next major American election rolls around, geospatial capabilities in general data-analysis software like Tableau and Power BI will be even more robust. And that's good news for anyone who needs to analyze geospatial data.

Interactive version of my Tableau map of data from the 2015 American community survey:

Want to read more about GIS? See Mapping in R just got a whole lot easier.

Computerworld's IT Salary Survey 2017 results
Shop Tech Products at Amazon