Open Table of Contents

ET GeoWizards Scripting

RandomPointsInPolygon
(Go to the main page of the function)

Generates random points located in the polygons of the input polygon dataset. The number of points per polygon can be constant or different for each polygon - based on the values in a numeric field of the input polygon feature class.

Syntax    

Dim ET As  New ETGW_Core
Set variable =  ET.RandomPointsInPolygon(pInFeatureClass, sOutFileName, sValueField, lNumberPoints, sMessage)

The RandomPointsInPolygon method syntax has the following object qualifier and arguments:

Part Description
variable An IFeatureClass object
pInFeatureClass Required. An IFeatureClass object (Must be a Polygon feature class)
sOutFileName Required. A String - the full name of the output feature class (A feature class with the same full name should not exist)
sValueField Required. A numeric field which values will be used to get the number of points to be generated per polygon. If you want to use a constant number of points per polygon set sValueField = ""
lNumberPoints Required. A number that is used in two ways
  • If a sValueField is specified,  lNumberPoints is used as maximum points allowed per polygon
  • If a sValueField is an empty string, lNumberPoints is used as a constant that define the number of  points to be generated per polygon
sMessage Optional. In a case of failure -  description of the cause. If the functions completes with success an empty string will be returned. 

Example