If you have read some of my other posts you might have realized that I really like hex bins. There is something about a uniform grid of hexagons that just looks so nice. Maybe it has something to do with playing Settlers of Catan in my youth that has given me such a fondness for the hexagon grid. My first introduction to using hexbins for science was during my masters thesis project. I was producing a variety of x-y plots for large datasets. I was looking for trends that could help target high grade ore mineralization. Unfortunately because of all the data points a large amount of over plotting was occurring. Over plotting happens when you have so many points over lapping that you cannot see how many there are. My first approach to solving the problem was altering the transparency of points so that stacks of points would appear more opaque. Eventually while searching for a solution I came across hex bin plots. For this type of plot you overlay a regular grid of hexagons and then count the number of points in each hexagons (hexagon histogram). Once you have the number of points per hex you colour the hexagons to represent the number of dots.
This approach also works well for mapping. A map showing points is basically an x-y plot. If you can generate a hexagon polygon layer then you can count the number of points in each hexagon for display. With geographic data you have even more options if you have attribute values for each point. With attribute values for points you can now calculate the sum, average, standard deviation etc. for the points in each hexagon. If your points represent households and an attribute had the number of people per house your hexagon grid can represent population. If your points represent the location of a customer and the attribute is total value of purchases you can map where purchases are coming from. The number of opportunities is endless!
When I was learning how to create a hexbin grid I was unable to find a good solution using ArcMap Desktop. There were some third party options but I didn’t quite figure them out. After some digging I was able to come up with a solution using the opensource software QGIS. A link for the procedure I used can be found on my blog post here.
Using ArcGIS Pro to Create a Hexagon Grid
I was very excited when I came across a post about using ArcGIS Pro to create a hexagon grid. I decided to write this post about my experience testing out the procedure. This also provided me an opportunity to play around a bit more with ArcGIS Pro since I am new to this software from Esri.
The process has two major steps 1) Create a hexagon Grid and 2) Summarize the values to the hexagon grid
Creating a Tessellation Grid
The first step is to generate a tesselation grid. To find this tool under the Analysis Tab at the top click the Tools toolbox.
The help for this tool describes it as ‘Generates a polygon feature class of a tessellated grid of regular polygons which will entirely cover a given extent. The tessellation can be of triangles, squares, or hexagons’.
Using this tool you can specify the extent manually or select a layer in your project to have the grid cover that layer. For my test run I changed the Shape Type to Hexagon (although I kind of want to try out a triangle grid now). I used 5 square kilometers as the size for each grid and the spatial reference system of my input file. Hit Run at the bottom right and you should have your grid pretty quick. If you make your grid size smaller it will take longer to generate the polygon file. So far this was really too easy, and didn’t involve any third party add-ins.
Reshaping the Input Data to the Hexagon Grid Using Summarize Within
The next step is to reshape the data to the hexagon grid. This process is very easy to conceptualize using points. Every point that falls within a hexagon belongs to it and the attributes you select will be aggregated to that hexagon. Things get a little bit more complicated when you are aggregating a polygon layer to the hexagon polygon layer. See the picture below.
In this image I am showing the summarized value for each hexagon with the white halo and the dissemination values in black. We now have hexagons which are on top of multiple smaller and oddly shaped polygons. So what has happened is that the area of each DA polygon in each hexagon is calculated and then the values for the DA are spread out proportionally by area into each hexagon. The concept is fairly straight forward but the math can get kind of complex, luckily for us the Summarize Within tool does all the heavy lifting for us!
Go to the ArcGIS Pro toolbox and search for ‘Summarize Within’. The Summarize Within tool description is ‘Overlays a polygon layer with another layer to summarize the number of points, length of the lines, or area of the polygons within each polygon, and calculate attribute field statistics about those features within the polygons.’
For the input polygon pick the hexagon layer you just created. The input summary features contain the values you want to summarize. As I mentioned for my example I am summarizing a polygon dataset. You can keep polygons with no points or have them removed from the dataset. Finally you pick each of the fields you would like to summarize and pick a statistical method. For my project I set it up to sum the total population. Go to the bottom and press Run and away you go. ArcGIS Pro does all of the heavy lifting and redistribution of data for us.
So lets look at a comparison of the dissemination area data to the hexbin grid data. A major benefit to switching to a hexbin grid is that all of the data is now shown with the same sized polygons. If you have a teeny tiny polygon with a huge population it wont be glossed over, it will now be summed into the hexagon and be just as visible as any other polygon. You can see how the interpretation for high population areas changes drastically between the dissemination area and the hexagons.
I also produced a swip map to check out the differences between the dissemination area and hex bin grid map. To produce this I used ArcGIS online and the Story Map Swipe template. It really makes it easy to dig in and see some of the more subtle changes. Click here to launch it in a new full screen tab.
So now that I have run through the work flow I can definitely say that I loved it! That was so easy and all within one application. No third party add-ins, no fussing around, just quick and easy and straight to data discovery. Now everyone can hex bin their data and also enjoy the simple beauty of the hexagon.