Mathematicians were informally using this type of diagram as early as the 17th century. However, it wasn’t until about a hundred years ago when Ukrainian mathematician Georgy Voronoi defined a solid mathematical theory supporting proximity analysis.
Voronoi diagrams can be used in many different disciplines like meteorology, geophysics, epidemiology, biology, mining, city planning, wherever there is a need to analyze spatially distributed data. In aviation, they are used to identify the nearest landing strip in case of diversion.
In this Tableau/FME exercise, I set out to see the distribution of international airports in the US and identify the most remote US airports, i.e. airports surrounded by the largest Voronoi polygon. The following is a breakdown of my process.
I found a list of US international airports with passenger statistics on Wikipedia, unfortunately it doesn’t include coordinates. Luckily, there is an up to date listing of all airports in the world, including lats and longs on Our Airports website. Perfect, I would use it to lookup coordinates for the airports listed on Wikipedia.
For the map of the US in a shapefile format, I always go to the US Census website. There you can find a comprehensive repository of national and state administrative units in the US. For this project I just needed a US outline.
Reshaping Data and Creating Voronoi Polygons
I used FME to create the Voronoi polygons and reshape my data. I’ve used FME on other projects and I love how easy it is to create reusable, automated workflows and handle geographic data in practically any way imaginable. Here’s the FME workflow I made for this project.
I’ll break it down into several pieces to highlight what FME does.
Workflow – Part 1
- Imports both lists of airports (US and world) in Excel format.
- Blends them (with FeatureMerger transformer) based on the common IATA code and tags each US airport with lat/long coordinates.
- Filters only US mainland international airports. For simplicity, I wanted to only map airports in the contiguous US, so I excluded airports in Alaska, Hawaii and US territories. I also excluded all airports that did not have “International” in their name.
- Creates point geometry (VertexCreator) based on each airport’s coordinate.
- Supplies these points as an input to the VoronoiDiagrammer transformer.
Workflow – Part 2
- Imports the shapefile of US boundary.
- Filters out states and territories outside of 48 contiguous states.
- Removes the internal state boundaries (Dissolver)
After I ran the complete workflow, I noticed that I had many more Voronoi polygons than airports. This wasn’t right. As it turned out, FME created separate polygons for each little off-shore island and this required fixing. I used Deaggregator, Filter and Aggregator to clean up the geography and get a single continental US boundary polygon.
Workflow – Part 3
- Voronoi diagrams know no boundaries. They will extend way past your area of interest and need to be trimmed. The Clipper transformer takes Voronoi diagrams as a Clippee and the US boundary as a Clipper and creates a nicely trimmed proper map.
- The remainder of the workflow reprojects polygon and point data from Mercator to a conical projection (more about that in a bit), calculates the area of each Voronoi polygon, cleans up the attributes, and exports our data to shapefiles.
Creating an Alternative Map Projection in Tableau
If you have ever tried to create a map in Tableau, you know that it always defaults to a Mercator projection. This is the projection where the western part of the border between Canada and US is a straight, horizontal line. I, however, wanted to build a map in a different (conic) projection, this is why I reprojected my US boundary shapefile in FME from the Mercator to Albers coordinate system. The problem is that no matter your shapefile’s projection, Tableau will always display it in Mercator to conform it to its background maps.
It looks like Tableau reprojects the geographic file it connects to on the fly. But not all is lost. It turns out that you can trick Tableau into thinking the map is already in Mercator projection to leave it as is. As Tableau’s background map is in Mercator, our polygons don’t overlay on it properly but we can always drop transparency to zero to mask this issue.
How do we trick Tableau into doing this? The idea for this comes from Tableau’s researcher Sarah Battersby, who suggested changing the projection definition in QGIS. But I tinkered with the projection file (.prj file that is a part of a shapefile bundle) and discovered that merely changing the name of the projection from Albers to Mercator does the job. Be warned however, this is an untested hack, it worked in this situation but I haven’t tested it on other maps and with other projections.
Making the Map Blend with the Dark Background
So we have our map in Tableau but we changed the Washout setting on the background to 100% and now the background is white. And there is no setting to change the color of the map background.
There is a solution to that too! I used Mapbox to create a custom background map. I removed all graphical elements and left only a solid background with a color set to what I wanted it to be in Tableau, and I replaced the default background map in Tableau with the Mapbox map I just created.
Putting it All Together in Tableau
The rest of the work was all Tableau, building a dashboard with a custom legend, icons, and selecting an appropriate color palette.
Hope you enjoyed this lengthy article! Please post a comment and share broadly, and feel free to email me if you have any questions.