Show Navigation | Hide Navigation
You are here:
Extensions > Spatial Analyst > Spatial Analyst functional reference > Generalization (Spatial Analyst)

Aggregate

Release 9.2
Last modified January 3, 2008
E-mail This Topic Printable Version Give Us Feedback

Print all topics in : "Generalization (Spatial Analyst)"


Related Topics

Generates a reduced resolution version of a raster.

Learn more about how Aggregate works


Illustration

Aggregate illustration

Usage tips

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.

  • EXPAND  — Expands the bottom or right boundaries of the input raster so the total number of cells in a row or column is a multiple of the cell_factor. Expanded cells are given a value of NoData. With this option, the output raster can cover a larger spatial extent than the input raster.
  • TRUNCATE  — Reduces the number of rows or columns in the output raster by one. This will truncate the remaining cells on the bottom or right boundaries of the input raster, making the number of rows or columns in the input raster a multiple of the cell_factor. With this option, the output raster can cover a smaller spatial extent than the input raster.

Boolean
{DATA | NODATA}

Denotes whether NoData values are ignored by the aggregation calculation.

  • DATA  — Specifies that if NoData values exist for any of the cells that fall within the spatial extent of a larger cell on the output raster, the NoData values will be ignored when determining the value for output cell locations. Only input cells within the extent of the output cell that have data values will be used in determining the value of the output cell.
  • NODATA  — Specifies that if any cell that falls within the spatial extent of a larger cell on the output raster has a value of NoData, the value for that output cell location will be NoData. When the NODATA keyword is used, 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.

Boolean
Data types for geoprocessing tool parameters


Command line example

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.

  • EXPAND  — Expands the bottom or right boundaries of the input raster so the total number of cells in a row or column is a multiple of the cell_factor. Expanded cells are given a value of NoData. With this option, the output raster can cover a larger spatial extent than the input raster.
  • TRUNCATE  — Reduces the number of rows or columns in the output raster by one. This will truncate the remaining cells on the bottom or right boundaries of the input raster, making the number of rows or columns in the input raster a multiple of the cell_factor. With this option, the output raster can cover a smaller spatial extent than the input raster.

Boolean
ignore_nodata (Optional)

Denotes whether NoData values are ignored by the aggregation calculation.

  • DATA  — Specifies that if NoData values exist for any of the cells that fall within the spatial extent of a larger cell on the output raster, the NoData values will be ignored when determining the value for output cell locations. Only input cells within the extent of the output cell that have data values will be used in determining the value of the output cell.
  • NODATA  — Specifies that if any cell that falls within the spatial extent of a larger cell on the output raster has a value of NoData, the value for that output cell location will be NoData. When the NODATA keyword is used, 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.

Boolean

Data types for geoprocessing tool parameters


Script example

# 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.
  • EXPAND  — Expands the bottom, right, or bottom right boundaries of the input grid so the total number of cells in a row, column, or row and column is a multiple of the <cell_factor>. Expanded cells are given a value of NoData. With this option, the output grid can cover a larger spatial extent than the input grid.
  • TRUNCATE  — Reduces the number of rows, columns, or rows and columns in the output grid by one. This will truncate the remaining cells on the bottom, right, or bottom right boundaries of the input grid, making the number of rows, columns, or rows and columns in the input grid a multiple of the <cell_factor>. With this option, the output grid can cover a smaller spatial extent than the input grid.
{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.
  • DATA  — Specifies that if a NoData value exists for any of the cells that fall within the spatial extent of a larger cell on the output grid, the NoData value will be ignored when determining the value for that output cell location. Only input cells within the output cell extent that have data values will be used in determining the value of the output cell.
  • NODATA  — Specifies that if any cell that falls within the spatial extent of a larger cell on the output grid has a value of NoData, the value for that output cell location will be NoData. When the NODATA keyword is used, 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.

Map Algebra example

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.

ArcObjects example

' 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)

Please visit the Feedback page to comment or give suggestions on ArcGIS Desktop Help.
Copyright © Environmental Systems Research Institute, Inc.