The practice of binning point data to form a type of 2D histogram, density plot, or what is sometimes called a heatmap, is quite useful as an alternative for the cartographic display of of very dense points sets. This is particularly the case when the points experience significant overlap at the displayed scale. The Point Density tool can be used to perform binning based on a regular grid (raster output). This tool, by comparison, bases the binning on a hexagonal grid.
The tool is similar to the Create Hexagonal Vector Grid tool, however instead will create an output hexagonal grid in which each hexagonal cell possesses a COUNT attribute which specifies the number of points from an input points file (either ShapeFile or LAS file) that are contained within the hexagonal cell.
In addition to the names of the input points file and the output ShapeFile, the user must
also specify the desired hexagon width (w), which is the distance between opposing sides
of each hexagon. The size (s) each side of the hexagon can then be calculated as,
s = w / [2 x cos(PI / 6)]
. The area of each hexagon (A) is,
A = 3s(w / 2)
. The user must also specify the orientation of the grid with options
of horizontal (pointy side up) and vertical (flat side up).
The following is an example of a Python script using this tool:
wd = pluginHost.getWorkingDirectory()
# The tool accepts both SHP and LAS files
inputFile = wd + "input.shp"
outputFile = wd + "output.shp"
hexWidth = "10.0"
gridDirection = "horizontal"
args = [inputFile, outputFile, hexWidth, gridDirection]
pluginHost.runPlugin("Hexbinning", args, False)
This is a Groovy script also using this tool:
def wd = pluginHost.getWorkingDirectory()
// The tool accepts both SHP and LAS files
def inputFile = wd + "input.las"
def outputFile = wd + "output.shp"
def hexWidth = "10.0"
def gridDirection = "vertical"
String[] args = [inputFile, outputFile, hexWidth, gridDirection]
pluginHost.runPlugin("Hexbinning", args, false)