Slice |
|
Release 9.2
Last modified January 3, 2008 |
Print all topics in : "Reclass (Spatial Analyst)" |
Slices a range of values of the input cells of a raster by zones of equal interval, equal area, or by natural breaks.
Learn more about how Slice works
Usage tips
Command line and Scripting
If a mask has been set, those cells that have been masked will receive NoData on the output slice raster.
The output raster from Slice will always be of integer type.
Slice in geoprocessing does not have the Table option that was available in Map Algebra.
The following environment settings affect this tool:
Map Algebra
If a mask has been set, those cells that have been masked will receive NoData on the output slice raster.
The input values to be sliced do not have to be the values associated with the value item in the raster's value attribute table. Any numeric item in the value attribute table can be used in the Slice function. For example:
slice(ingrid1.texture, table, tex_tab)
In the above expression, the values associated with the texture item in the value attribute table will be sliced as specified by the remap table named tex_tab.
The INFO remap table can be any existing table that meets the criteria specified in How Slice works. Any two items in the INFO table can be used for the mapping of the input values to the output values.
The INFO remap table is created like any other INFO table in ArcInfo as long as it meets the parameters listed below.
The output raster from the Slice function will always be of integer type. If the output assignment values in the remap table are floating-point values, they will be truncated before the slice.
A new raster is created by the Slice function; it is not only a table manipulation.
Learn more about how to specify the input raster dataset in the Map Algebra expression of Raster Calculator.
ArcObjects
Valid input for the geoDataset to ArcObjects is a Raster, RasterDataset, RasterBand, or RasterDescriptor.
If a mask has been set, those cells that have been masked will receive NoData on the output slice raster.
The Slice method in ArcObjects does not have the Table Slice option as in the Map Algebra function.
The output raster from the Slice method will always be of integer type.
Command line syntax
An overview of the Command Line window
Slice_sa <in_raster> <out_raster> <number_zones> {EQUAL_INTERVAL | EQUAL_AREA | NATURAL_BREAKS} {base_output_zone}
Parameter | Explanation | Data Type |
<in_raster> |
An input Raster, RasterDataset, RasterBand, or RasterDescriptor. |
Composite Geodataset |
<out_raster> |
The raster to be created. |
Raster Dataset |
<number_zones> |
When the Slice method is Equal_Area, the output raster will have number_zones with a similar number of cells in each. When Equal_Interval is used, the output raster will have number_zones, each containing equal value ranges on the output raster. When Natural_Breaks is used, the output raster will have number_zones, with the number of cells in each determined by the class breaks. |
Long |
{EQUAL_INTERVAL | EQUAL_AREA | NATURAL_BREAKS} |
The manner in which to slice the values in the input raster.
|
String |
{base_output_zone} |
Defines the lowest zone value on the output raster dataset. The default value is one. |
Long |
Slice_sa c:/data/ras_1 c:/data/final_1 3 EQUAL_INTERVAL 1
Scripting syntax
About getting started with writing geoprocessing scripts
Slice_sa (in_raster, out_raster, number_zones, slice_type, base_output_zone)
Parameter | Explanation | Data Type |
in_raster (Required) |
An input Raster, RasterDataset, RasterBand, or RasterDescriptor. |
Composite Geodataset |
out_raster (Required) |
The raster to be created. |
Raster Dataset |
number_zones (Required) |
When the Slice method is Equal_Area, the output raster will have number_zones with a similar number of cells in each. When Equal_Interval is used, the output raster will have number_zones, each containing equal value ranges on the output raster. When Natural_Breaks is used, the output raster will have number_zones, with the number of cells in each determined by the class breaks. |
Long |
slice_type (Optional) |
The manner in which to slice the values in the input raster.
|
String |
base_output_zone (Optional) |
Defines the lowest zone value on the output raster dataset. The default value is one. |
Long |
# Slice.py # Description: # Slices a range of values of the input cells of a raster by # zones of equal interval or equal area. # Requirements: None # Author: ESRI # Date: Sept 6, 2005 # Import system modules import arcgisscripting # Create the Geoprocessor object gp = arcgisscripting.create() try: # Set the input files inRaster = "c:/data/ras_1" # Set the output raster name outRaster = "c:/data/final_1" # Check out ArcGIS Spatial Analyst extension license gp.CheckOutExtension("Spatial") # Set the base zone value and the number of slices baseZoneForInput = 1 numberOfSlices = 3 # Process: Slice gp.Slice_sa(inRaster, outRaster, numberOfSlices, "EQUAL_INTERVAL", baseZoneForInput) except: # If an error occurred while running a tool, then print the messages print gp.GetMessages()
Map Algebra syntax
Slice(<grid>, TABLE, <remap_table>, {in_item}, {out_item}, {in_min})
Parameter | Explanation |
<grid> | An input integer, floating-point raster, or an expression resulting in a raster.
The values contained in this raster will be the values that are sliced. |
TABLE | Keyword specifying that a remap table will be used in the slicing process. |
<remap_table> | An ASCII or INFO remap table specifying which values are to be changed and to what output values.
See How Slice works for the format of a remap table. |
{in_item} | Specifies the input item in an INFO remap table.
The values in {in_item} specify the levels into which the raster will be sliced. This option is not available if the remap table is an ASCII file. |
{out_item} | Specifies the output item in an INFO remap table.
The values in {out_item} specify the output values for each level after slicing. This option is not available if the remap table is an ASCII file. |
{in_min} | A number that identifies the minimum value from the input raster for slicing.
If the keyword TABLE is used when an input value for a cell location is below the {in_min} number, the cell will be assigned NoData and won't be considered in the slice calculations. When the keywords EQAREA, EQINTERVAL, and NATURALBREAKS are used, the cells with values smaller than the {in_min} value will be assigned NoData and won't be considered in the calculations. The output results will vary depending on the number of input values on the input raster that exceeds the {in_min} value. |
EQAREA | Keyword specifying that the input values will be divided into the numbers of zones specified by {nzones} with each zone having a similar number of cells — each zone represents a similar amount of area. |
{nzones} | Defines the number of zones that should be used with the calculations of equal area, equal interval, and natural breaks slicing methods.
When the keyword EQAREA is used, the output raster will have {nzones} with a similar number of cells. When the keyword EQINTERVAL is used, the output raster will have {nzones}, each containing equal value ranges on the output raster. When the keyword NATURALBREAKS is used, the output raster will have {nzones} based on inherent groupings in the data. |
{base_zone#} | An integer that defines the lowest zone value on the output raster.
When the keywords EQAREA, EQINTERVAL, and NATURALBREAKS are used, the number that is input for the {base_zone#} identifies the value to assign to the output sliced zones. The zones will begin with the value assigned to the {base_zone#} and increment by one. If no {base_zone#} is specified, Slice will begin the value assignment at one. |
{in_max} | A number that identifies the maximum acceptable value from the input raster.
When the keywords EQAREA, EQINTERVAL, and NATURALBREAKS are used, the cells with values above the {in_max} number will be assigned NoData and won't be considered in the area and interval slice calculations. The output results will vary depending on the number of input values on the input raster that exceed {in_max}. |
EQINTERVAL | The EQINTERVAL slice determines the range of the input values and divides the range into {nzones}.
Each zone on the sliced output raster has the potential of having input cell values that have the same range from the extremes. |
NATURALBREAKS | Keyword specifying that the classes will be based on natural groupings inherent in the data.
Break points are identified by choosing the class breaks that best group similar values and maximize the differences between classes. The cell values are divided into classes whose boundaries are set when there are relatively big jumps in the data values. |
slice(ingrid1, TABLE, remap_tab) slice(ingrid1, table, remap_tab, #, #, 10) slice(ingrid1, EQAREA, 5) slice(ingrid1, eqarea, 10, 3, 20, 500) slice(ingrid1, eqinterval, 20) slice(ingrid1, EQINTERVAL, 15, #, 20)
ArcObjects syntax
IReclassOp::Slice (geoDataset As IGeoDataset, sliceType As esriGeoAnalysisSliceEnum, zoneCount As Long, [baseZone As Variant]) As IGeoDataset
Parameter | Explanation |
geoDataset | An input Raster, RasterDataset, RasterBand, or RasterDescriptor.
The values contained in this raster will be the values that are sliced. |
sliceType | An esriGeoAnalysisSliceEnum specifying the manner in which to slice the values in the input geoDataset.
|
zoneCount | Defines the number of zones that should be used with the calculations of equal area and equal interval slicing methods.
When the sliceType EqualArea is used, the output raster will have zoneCounts with similar numbers of cells. When the sliceType EqualInterval is used, the output raster will have zoneCounts, each containing equal value ranges on the output raster. When the sliceType NaturalBreaks is used, the output raster will have zoneCounts with the number of cells in each determined by the class breaks. |
baseZone | An integer that defines the lowest zone value on the output raster.
When the sliceTypes EqualArea, EqualInterval, and NaturalBreaks are used, the number that is input for the baseZone identifies the value to assign to the output sliced zones. The zones will begin with the value assigned to the baseZone and increment by one. If no base zone is specified, Slice will begin the value assignment at one. |
' Create the RasterReclassOp object Dim pReclassOp As IReclassOp Set pReclassOp = New RasterReclassOp ' Declare the input raster object Dim pInputDataset As IGeoDataset ' Calls function to open a raster dataset from disk Set pInputDataset = OpenRasterDataset("D:\SpatialData", "inputdataset") ' Declare the output raster object Dim pOutputRaster As IGeoDataset ' Calls the method Set pOutputRaster = pReclassOp.Slice(pInputDataset, esriGeoAnalysisSliceEqualArea, 10)