### Description

This tool generates samples of regularly spaced points within polygons. The spacing in the x and y directions, and the rotation angle for the orientation of the sampling grid, can be adjusted for each polygon or can be set as constants for every polygon. The x and y distance parameters (xdist, ydist) can, therefore, be set either to a single value, or can reference fields in the input polygon data source that contain the appropriate spacing values for each polygon. The x spacing refers to the axis perpendicular to the rotation angle, and the y spacing refers to the axis parallel to the rotation angle. Thus, if there is no rotation (rot=0), the x distance refers to the east-west axis.

Note that the rotation angle must be specified in radians, not degrees. To convert from degrees to radians use the formula: radians = degrees * pi / 180, where pi = 3.141529654.

The 'excl' option can be used to prevent points from being generated within the polygons of this dataset. For example, if you were to generate vegetation sampling points you might use a polygon layer representing ponds as the exclusion layer to prevent points from occurring in water.

### Syntax

genregularpntsinpolys(in, uidfield, xdist, ydist, out, [rot], [excl], [random], [where]);

in | the input reference polygon data source (points are only generated within polygons) | |

uidfield | the input polygon unique ID field | |

xdist | the x-axis sampling distance: either a number representing the distance, or the field name of field containing this value, e.g. 100 or "XDIST" | |

ydist | the y-axis sampling distance: either a number representing the distance, or the field name of field containing this value, e.g. 100 or "YDIST" | |

out | the output point data source | |

[rot] | the rotation angle of the sampling axis: either a number representing the angle in radians, or the field name of field containing this value (default=0) | |

[excl] | the polygon data source containing exclusion polygons: points are prevented from being generated within these polygons; this option can be dangerous - see the help documentation for details | |

[random] | (TRUE/FALSE) randomize the alignment of the grid - if false, always aligns the grid in reference to the upper left corner of the polygon envelope (default=TRUE) | |

[where] | the filter/selection statement that will be applied to the polygon feature class to identify a subset of features to process |

### Example

genregularpntsinpolys(in="C:\data\stands.shp", uidfield="StandID", xdist=100, ydist=200, rot="Direction", out="C:\data\samplepnts.shp");

genregularpntsinpolys(in="C:\data\lakes.shp", uidfield="LAKEID", xdist="SpacingX", ydist="SpacingY", rot=0, out="C:\data\samplepnts.shp", where="AREA>100000");