Create Random Points (Data Management) (ArcInfo only) |
|
Release 9.2
Last modified November 29, 2010 |
Print all topics in : "Tools" |
NOTE: This tool is available with an ArcView or ArcEditor license, if the Spatial Analyst extension or the 3D Analyst extension is installed.
Creates a user specified number of random points in an extent, in the polygons of a feature class or along the lines of a feature class. Learn more about how Create Random Points works.
Usage tips
The extent in which to place the points can be defined two ways, by the {constraining_featureclass} or by the {constraining_extent}. When the dialog is first opened both parameters are enabled. The {constraining_featureclass} will be empty and the {constraining_extent} will contain the extent values from the environment.
If a feature class is entered for the {constraining_featureclass} the {constraining_extent} parameters will be grayed out but the extent values for the {constraining_featureclass} will populate the fields. If a {constraining_featureclass} is entered the field must be emptied by deleting the input string if you would rather enter a {constraining_extent}. By emptying the {constraining_featureclass} the {constraining_extent} is re-enabled. The {constraining_featureclass} will always take precedent.
The {number_of_points} also relies on the {constraining_featureclass}. If a {constraing_featureclass} is specified, both the Field and Long options are enabled. If no {constraining_featureclss} is entered then only the Long option is enabled.
The Extent when set in the Environment acts as a selection on the input. Any feature that touches the extent in anyway is processed. Even if only a small part of the feature falls within the extent, the entire feature will be processed. Thus, if an extent has been specified in the environment and a constraining featureclass is specified on the CreateRandomPoints tool, random points will only be placed in those features that 'touch' the extent defined in the environment.
The input "constraining extent" on the CreateRandomPoints tool will act simply as a box into which points are placed. A constraining feature class and a constraining extent cannot be specified at the same time. If they are, the constraining feature class takes precedence and the constraining extent is ignored. The constraining extent controls the output so it will not interact with the extent from the environment which acts only on the input.
To assign random values to randomly placed points is a three step process. First, a specified number of points is place with the CreateRandomPoints tool. Second, the AddField tool is used to create a new field in the output feature layer from the CreateRandomPoints tool. Third, the CalculateField tool is used to assign the random values to the newly created field by directly using the ArcGIS.Rand() function with a distribution in a simple expression, or using the ArcGIS.Rand() function in a complex expression.
The following environment affects this tool: Workspace, and scratch workspace.
Command line syntax
An overview of the Command Line window
CreateRandomPoints_management <out_path> <out_name> {constraining_feature_class} {constraining_extent} {number_of_points_or_field}
Parameter | Explanation | Data Type |
<out_path> |
The ArcSDE, personal or file geodatabase, or workspace in which the output feature class will be created. This workspace must already exist. |
Workspace | Raster Catalog |
<out_name> |
The name of the feature class to be created. |
String |
{constraining_feature_class} |
The feature class which contains the features into which the random points will be placed. If a polygon feature class is specified, points will be randomly placed into the polygons. If a line feature class is specified, points will be randomly placed along the lines. |
Feature Layer |
{constraining_extent} |
The extent into which points will be randomly placed. The extent will only be used if no constraining feature class is specified. |
Extent |
{number_of_points_or_field} |
The number of points to be randomly placed. When a single number is specified, each feature in the feature class will have the same number of randomly placed points. When a field is specified, the number of randomly placed points is equal to the value of the field specified for that feature. |
Field | Long |
CreateRandomPoints c:\data\project samplepoints # c:\data\project\studyarea.shp 500
Scripting syntax
About getting started with writing geoprocessing scripts
CreateRandomPoints_management (out_path, out_name, constraining_feature_class, constraining_extent, number_of_points_or_field)
Parameter | Explanation | Data Type |
out_path (Required) |
The ArcSDE, personal or file geodatabase, or workspace in which the output feature class will be created. This workspace must already exist. |
Workspace | Raster Catalog |
out_name (Required) |
The name of the feature class to be created. |
String |
constraining_feature_class (Optional) |
The feature class which contains the features into which the random points will be placed. If a polygon feature class is specified, points will be randomly placed into the polygons. If a line feature class is specified, points will be randomly placed along the lines. |
Feature Layer |
constraining_extent (Optional) |
The extent into which points will be randomly placed. The extent will only be used if no constraining feature class is specified. |
Extent |
number_of_points_or_field (Optional) |
The number of points to be randomly placed. When a single number is specified, each feature in the feature class will have the same number of randomly placed points. When a field is specified, the number of randomly placed points is equal to the value of the field specified for that feature. |
Field | Long |
# Create geoprocessor import arcgisscripting gp = arcgisscripting.create() gp.overwriteoutput = 1 # Create random points in an extent defined simply by numbers gp.outputcoordinatesystem = r"Coordinate Systems\Projected Coordinate Systems\World\Miller Cylindrical (world).prj" gp.CreateRandomPoints("C:/temp", "myRandPnts.shp", "", "0 0 1000 1000", 100) gp.outputcoordinatesystem = "" # Create random points in an extent defined by another feature class gp.CreateRandomPoints("C:/data", "testpoints.shp", "", "C:/data/studyarea.shp", 100) # Create random points in the features of a contstraining feature class # Number of points for each feature determined by the value in the field specified gp.CreateRandomPoints("C:/data/county.gdb", "randpeople", "C:/data/county.gdb/blocks", "", "POP2000")