Aggregate |
|
Release 9.2
Last modified January 3, 2008 |
Print all topics in : "Generalization (Spatial Analyst)" |
Generates a reduced resolution version of a raster.
Learn more about how Aggregate works
Illustration
Usage tips
Command line and Scripting
If the values of the input raster are integers and any statistics type option other than Mean is used, the output raster will be integer. If the values of the input raster are floating point or the statistics type is Mean, the output raster will be floating point.
The geoprocessing analysis environment (Extent, Cell Size, and Mask) is recognized by the Aggregate function. To determine the output raster's resolution when an integer cell size has been specified, multiply the cell resolution of the analysis environment by the input cell factor parameter. If the cell size for the analysis environment is set to the minimum or maximum of the inputs, the resolution of the output raster will be the product of the input raster's resolution multiplied by the specified cell factor.
The following environment settings affect this tool:
Map Algebra
If the values in the input grid are integer and the Mean option is not used, the values in the output grid will be integer. If the values in the input grid are floating point or the Mean option is used, the values in the output grid will be floating point.
The analysis environment (Extent, Cell Size, and Mask) is recognized by the Aggregate function. To determine the output grid's resolution when an integer has been specified on the Cell Size tab on the ArcGIS Spatial Analyst Option dialog box, multiply the cell resolution of the analysis environment by the input cell factor parameter. If the cell resolution for the analysis environment is set to Minimum of the Inputs or Maximum of the Inputs, the resolution of the output grid will be the product of the input grid resolution multiplied by the specified cell factor.
Learn more about how to specify the input raster dataset in the Map Algebra expression of Raster Calculator.
ArcObjects
The output from the ArcObjects method is a raster object.
The esriGeoAnalysisStatistics supports five of the listed enumerations. These are esriGeoAnalysisStatisticsMaximum, esriGeoAnalysisStatisticsMean, esriGeoAnalysisStatisticsMedian, esriGeoAnalysisStatisticsMinimum, and esriGeoAnalysisStatisticsSum.
If the values of the input raster are integer and any statistics type option other than Mean is used, the output raster will be integer. If the values of the input raster are floating point, or the statistics type is Mean, the output raster will be floating point.
Command line syntax
An overview of the Command Line window
Aggregate_sa <in_raster> <out_raster> <cell_factor> {SUM | MAXIMUM | MEAN | MEDIAN | MINIMUM} {extent_handling} {DATA | NODATA}
Parameter | Explanation | Data Type |
<in_raster> |
Input raster. |
Composite Geodataset |
<out_raster> |
The raster to be created. |
Raster Dataset |
<cell_factor> |
Factor by which to multiply the cell size of the input raster to obtain the desired resolution for the output raster. A cell_factor of three would result in an output cell size three times larger than that of the input raster. The cell_factor must be an integer greater than one. |
Long |
{SUM | MAXIMUM | MEAN | MEDIAN | MINIMUM} |
Establishes how the value for each output cell will be determined. The output value for each cell can be the sum, maximum, mean, median, or minimum value of the input cells that the coarser output cell will encompass. Sum is the default value. |
String |
{extent_handling} |
Defines how to handle the boundaries of the input raster when its rows or columns are not a multiple of the cell factor. If the number of rows and columns in the input grid is a multiple of the cell_factor, these keywords are not used.
|
Boolean |
{DATA | NODATA} |
Denotes whether NoData values are ignored by the aggregation calculation.
|
Boolean |
Aggregate_sa C:/data/ras_1 C:/data/final_1
Scripting syntax
About getting started with writing geoprocessing scripts
Aggregate_sa (in_raster, out_raster, cell_factor, aggregation_type, extent_handling, ignore_nodata)
Parameter | Explanation | Data Type |
in_raster (Required) |
Input raster. |
Composite Geodataset |
out_raster (Required) |
The raster to be created. |
Raster Dataset |
cell_factor (Required) |
Factor by which to multiply the cell size of the input raster to obtain the desired resolution for the output raster. A cell_factor of three would result in an output cell size three times larger than that of the input raster. The cell_factor must be an integer greater than one. |
Long |
aggregation_type (Optional) |
Establishes how the value for each output cell will be determined. The output value for each cell can be the sum, maximum, mean, median, or minimum value of the input cells that the coarser output cell will encompass. Sum is the default value. |
String |
extent_handling (Optional) |
Defines how to handle the boundaries of the input raster when its rows or columns are not a multiple of the cell factor. If the number of rows and columns in the input grid is a multiple of the cell_factor, these keywords are not used.
|
Boolean |
ignore_nodata (Optional) |
Denotes whether NoData values are ignored by the aggregation calculation.
|
Boolean |
# Aggregate_sample.py # Description: # Generates a reduced resolution version of a raster. # Requirements: None # Author: ESRI # Date: Sept 6, 2005 # Import system modules import arcgisscripting # Create the Geoprocessor object gp = arcgisscripting.create() try: # Set local variables outRaster = "C:/data/final_1" inRaster = "C:/data/ras_1" # Check out Spatial Analyst extension license gp.CheckOutExtension("Spatial") # Process: Aggregate... gp.Aggregate_sa(inRaster, outRaster, "3", "SUM", "EXPAND", "DATA") except: # If an error occurred while running a tool, then print the messages. print gp.GetMessages()
Map Algebra syntax
Aggregate(<grid>, <cell_factor>, {aggregation_type}, {EXPAND | TRUNCATE}, {DATA | NODATA})
Parameter | Explanation |
<grid> | An input integer, floating-point grid, or an expression resulting in a grid. |
<cell_factor> | A factor to multiply the cell size of the input grid to obtain the desired resolution for the output grid.
A <cell_factor> of three would result in an output cell size three times larger than the input grid cell size. The <cell_factor> must be an integer greater than one. |
{aggregation_type} | Establishes how the value for each output cell will be determined.
The output value for each cell can be the sum (Sum), minimum (Min), maximum (Max), mean (Mean), or median (Median) value of the input cells that the coarser output cell will encompass. By default, the Sum option is used. |
{EXPAND | TRUNCATE} | A keyword defining how to handle the boundaries of the input grid when the number of rows, columns, or both is not a multiple of the <cell_factor>.
If the number of rows and columns in the input grid is a multiple of the <cell_factor>, these keywords are not used.
|
{DATA | NODATA} | A keyword defining the manner in which NoData values on the input grid are handled when contained within the extent of a coarser output cell.
|
aggregate(ingrid1, 3) aggregate(ingrid1, 5, #, truncate, NODATA) aggregate(ingrid1, 2, max) aggregate(ingrid1, 20, mean, expand, NODATA) aggregate(ingrid1, 4.3, #, #, data) aggregate(ingrid1, 7, median)
ArcObjects syntax
IGeneralizeOp::Aggregate (raster As IGeoDataset, cellFactor As Long, aggregationType As esriGeoAnalysisStatisticsEnum, expandExtent As Boolean, ignoreNoData As Boolean ) As IGeoDataset
Parameter | Explanation |
geoDataset | An input Raster, RasterDataset, RasterBand, or RasterDescriptor. |
cellFactor | A factor to multiply the cell size of the input Raster to obtain the desired resolution for the output Raster.
A cellFactor of three would result in an output cell size three times larger than the input raster cell size. The cellFactor must be an integer greater than one. |
aggregationType | Establishes how the value for each output cell will be determined.
The output value for each cell can be the sum (esriGeoAnalysisStatsSum), minimum (esriGeoAnalysisStatsMinimum), maximum (esriGeoAnalysisStatsMaximum), mean (esriGeoAnalysisStatsMean), or median (esriGeoAnalysisStatsMedian) value of the input cells that the coarser output cell will encompass. |
expandExtent | A Boolean expression defining how to handle the boundaries of the input raster when the number of rows, columns, or rows and columns is not a multiple of the cellFactor.
If the number of rows and columns in the input raster is a multiple of the cellFactor, this Boolean expression will not be applied. A True Boolean expression will expand the bottom, right, or bottom right boundaries of the input raster so that the total number of cells in a row, column, or row and column is a multiple of the cellFactor. Expanded cells are given a value of NoData. With a True Boolean expression, the output raster can cover a larger spatial extent than the input raster. A False Boolean expression will reduce the number of rows, columns, or rows and columns in the output raster by one. This will truncate the remaining cells on the bottom, right, or bottom right boundaries of the input raster, making the number of rows, columns, or rows and columns in the input raster a multiple of the cellFactor. With this option, the output raster can cover a smaller spatial extent than the input raster. |
ignoreNoData | A Boolean expression that, if True, dictates that if a NoData value exists for any of the cells falling within the spatial extent of a larger cell on the output raster, the NoData value will be ignored when determining the value for that output cell location.
Only input cells within the extent of the output cells that have data values will be used in determining the value of the output cell. If False, any cell that falls within the spatial extent of a larger cell on the output raster that has a value of NoData will have an output of NoData. When the Boolean expression is True, it is implied that when cells within an aggregation contain the NoData value, there is insufficient information to perform the specified calculations necessary to determine an output value. |
' Create the RasterGeneralizeOp object Dim pGeneralizeOp As IGeneralizeOp Set pGeneralizeOp = New RasterGeneralizeOp ' Declare the input raster object Dim pInputDataset As IGeoDataset ' Calls function to open a raster dataset from disk Set pInputDataset = OpenRasterDataset ("D:\SpatialData", "inputraster") ' Declare the output raster object Dim pOutputRaster As IGeoDataset ' Calls the method Set pOutputRaster = pGeneralizeOp.Aggregate (pInputDataset, 4, esriGeoAnalysisStatsMean, True, True)