ArcObjects Library Reference (GeoAnalyst)  

IRasterNeighborhood.SetWeight Method

Sets a neighborhood object each of whose entries can be assigned a weight.

[Visual Basic .NET]
Public Sub SetWeight ( _
    ByVal height As Integer, _
    ByVal width As Integer, _
    ByRef entryValues As Object _
public void SetWeight (
    int height,
    int width,
    ref object entryValues
HRESULT SetWeight(
  long height,
  long width,
  VARIANT* entryValues


height [in]   height is a parameter of type long width [in]   width is a parameter of type long entryValues [in]   entryValues is a parameter of type VARIANT

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.



The number of cells in the x-direction of the neighborhood.


The number of cells in the y-direction of the neighborhood.


An array that defines the neighborhood and respective weight values.  The value of each cell position in the neighborhood is multiplied by the corresponding weight value and the products are used in the neighborhood calculation.  A "0" value is treated like any other value in the kernel.   

example: a weighted neighborhood array may look like the following.

3 0 0 0 4
0 2 0 3 0
0 0 1 0 0                        


Allows for defining an irregular neighborhood and for specifying which weights will be used to multiply the cell values on an input raster.  The x,y position for the processing cell within the neighborhood, with respect to the upper-left corner of the neighborhood, is determined by the following equations:

x = (width + 1)/2
y = (height + 1)/2

If the input number of cells is even, the x- and y-coordinates are computed using truncation.

See Also

IRasterNeighborhood Interface