Fill function

Available with Spatial Analyst license.


Locates and fills sinks and peaks in an elevation surface raster to remove small imperfections in the data. The function will fill in an iterative process until all sinks are filled within the specified Z Limit.

When an elevation surface is created with Ortho Mapping tools or by other means, there are often small but significant errors in the form of sinks and peaks in the data. In photogrammetry, sinks and peaks are often referred to as holes and spikes. Because surface data is often used in modeling, such as hydrologic modeling, it is important to correct these sink and peak errors in a manner consistent with the surrounding data.

A sink is a pixel with an undefined drainage direction; no pixels surrounding it are lower. The pour point is the boundary pixel with the lowest elevation for the contributing area of a sink. If the sink were filled with water, this is the point where water would pour out.

For example, consider a sink area where the pour point is 210 feet in elevation, and the deepest point within the sink is 204 feet (a difference of 6 feet). If the Z Limit is set to 8, this particular sink will be filled. However, if the Z Limit is set to 4, this sink will not be filled since the depth of this sink exceeds this difference and would be considered a valid sink.

For more detail about how the Fill function works, refer to How fill works.

This is a global raster function.


The Z Limit specifies the maximum difference allowed between the depth of a sink and the pour point and determines which sinks will be filled and which will remain untouched. The Z Limit is not the maximum depth to which a sink will be filled. All sinks that are less than the Z Limit, and lower than their lowest adjacent neighbor, will be filled to the height of their pour points. If the difference in z-values between a sink and its pour point is greater than the Z Limit, that sink will not be filled.

The Sink function can be used in advance of using the Fill function to find the number of sinks and help identify their depth. Knowing the depth of the sinks can help in determining an appropriate Z Limit.

The Fill function can also be used to remove peaks. A peak is a cell where no adjacent pixels are higher. To remove peaks, the input surface raster must be inverted. This can be performed with the Minus math function. Specify the highest value of the surface raster as the first input and surface raster as the second input in the Minus function.

The Z Limit can be applied to this process as well. If nothing is specified for z-limit, then all peaks will be removed. If it is specified, where the difference in z-value between a peak and its highest adjacent neighbor is greater than the Z Limit, that peak will not be removed.

If the surface raster is integer, the output filled raster will be integer type. If the input is floating point, the output raster will be floating point.


Parameter nameDescription


A single band raster elevation dataset.

Z Limit

The maximum elevation difference between a sink and its pour point to be filled.

Unless a value is specified for this parameter, all sinks will be filled, regardless of depth.

The value for Z Limit must be greater than zero.

Related topics

In this topic
  1. Overview
  2. Notes
  3. Parameters