### Description

This tool generates a regular arrangement of hexagons within the bounds of each polygon in a polygon data source. The user specifies the dimension of the hexagons (a constant) and the amount of spacing between adjacent hexagons. Only hexagons that are completely contained by each polygon are retained. Note that if the polygons overlap, then the resulting hexagons are also likely to overlap. If this tool does not suit your purpose you may find the 'genshapes' command more useful - it will also generate a regular arrangement of hexagons but without the constraint that the hexagons must be completely contained by the polygon. Also, the gencirclesinpolys command serves a similar function to this tool but using circles instead of hexagons.

There is an element of randomisation built into this tool: the overall placement of the hexagon grid is determined randomly so that if you run the tool twice, you will get a different result. This is important because it allows you to run the tool many times in an attempt to find the maximum number of hexagons that can fit in a given polygon. This will depend on the complex shape of the polygon and generally cannot be determined analytically.

Note that hexagons mesh together perfectly to completely cover space with no overlap and with no interstitial spaces between hexagons (unlike circles). However, the 'spacing' option does allow you to add overlap (a negative value) or increase the spacing between hexagons (a positive value).

One possible application of this tool might be estimating the number of viable home ranges that an area might contain.

### Syntax

genhexagonsinpolys(in, uidfield, out, dimension, [spacing], [where]);

in | the input polygon data source | |

uidfield | the unique ID field of the input feature data source | |

out | the output polygon data source | |

dimension | the distance from the centre of the hexagon to the middle of one of the six edges that define the hexagon (a constant specified in the coordinate system units of the reference layer) | |

[spacing] | the additional distance to add between hexagons (default= 0, which implies no interstitial spaces between hexagons; a negative value results in hexagon overlap) | |

[where] | the selection statement that will be applied to the feature data source to identify a subset of features to process (see full Help documentation for further details) |

### Example

genhexagonsinpolys(in="C:\data\referencelayer.shp", out="C:\data\myoutput.shp", dimension=100);

genhexagonsinpolys(in="C:\data\boundaries.shp", out="C:\data\myoutput.shp", dimension=100, dimension=30);