Create Random Raster

Open Table of Contents ToolBox Implementation
Creates an integer raster with random values in user defined range, cell size and extent. The extent can be imported from an existing feature class or raster.

Inputs:

  • Output raster name and format
  • Minimum and Maximum values that indicate the range of random values to be assigned to the cells of the output raster.
  • Cell Size of the output raster
  • Extents of the output raster (can be copied from an existing feature class or raster). The default extents are the current extents of the active view.
  • Output Spatial Reference. The default spatial reference is the one assigned to the data frame. If the extents are copied from an existing dataset, the default spatial reference is changed to the projection of this dataset. The selected spatial reference must be projected coordinate system.

Output:

  • An integer raster. Depending on the range specified, the output might be:
    • SHORT - signed 16 bit integer (values between -32768 and 32768)
    • LONG - signed 32 bit integer (values out of the range above)

Notes:

  • Initially the name of the output raster defines the raster format
    • no extension specified - ESRI binary GRID
    • .img extension (for example raster1.img) - ERDAS IMAGINE image.
    • .tif extension (for example raster1.tif - Tagged Image File Format (TIFF) image.
  • The initial output raster format can be changed by selecting the desired output in the dialog.
  • Currently only file based rasters are supported. Rasters cannot be stored in a GeoDatabase. After you get the desired result, you can export the raster to a GeoDatabase using the standard ArcGIS tools.

ToolBox implementation

Command line syntax

ETS_GPRandomRaster <Out Raster> {Out Spatial Reference} {Extent from Existing} <Extent><Cell Size><Min Value> <Max Value>

Parameters

Expression Explanation
<Out Raster> A String - the full name of the output raster (A raster with the same full name should not exist). The output raster type depends on the extension of the output file(see Notes above)
{Out Spatial Reference} The spatial reference of the output raster. The dialog allows the user to select a predefined spatial reference or import spatial reference from an existing dataset. If used from the Command Line, the user can just specify the full name of an existing dataset.
{Extent from Existing} A string representing the full path to an existing dataset. The extent of the output raster will have the extent of this dataset
<Extent> A String representing the extent of the output raster. Example
"0, 0, 500, 250"
<Cell Size> A Double representing the cell size
<Min Value> A Number representing the minimum value of the output raster
<Max Value> A  Number representing the maximum value of the output raster.

Examples:

  • ETS_GPRandomRaster c:\test\r1.img c:\test\source1.img c:\test\source1.img # 10 50 100 - will create raster "r1.img" with Cell Size = 10 Min Value = 50 and Max Value = 100 in "c:\00" folder. The spatial reference and the extent will be the same as the ones of the existing raster source1.img

  • ETS_GPRandomRaster c:\test\r1.img c:\test\source1.img  # "0, 0, 500, 250" 10 50 100 - will create raster "r1.img" with Cell Size = 10 Min Value = 50 and Max Value = 100 in "c:\00" folder. The spatial reference will be the same as the one of source1.img (must exist) and the extents will be defined by the envelope with X Min = 0, Y Min = 0, X Max = 500 and Y Max = 250

Scripting syntax

ETS_GPRandomRaster (Out Raster, Out Spatial Reference, Extent from Existing, Extent, Cell Size, Min Value, Max Value)

See the explanations above:
<> - required parameter
{} - optional parameter

All ESRI products mentioned are trademarks of Environmental Systems Research Institute, Inc.
Copyright: Ianko Tchoukanski