# Wedge neighborhood on Focal Statistics calculation

I am using Focal Statistics in Spatial Analyst of ArcMap10.2, and use the wedge type of neighborhood for a radius of 10 km around each processing pixel. I want to calculate the maximum elevation for four sectors of aspect which are: Northeast, Southeast, Southwest, and Northwest, which in degrees would mean 0-90, 90-180, 180-270, 270-360 respectively, If 0 degrees were on the north and the wedge would extend clockwise. Of course, as I have read from the ArcGIS Help, "The wedge extends counterclockwise from the starting angle to the ending angle. Angles are specified in arithmetic degrees from 0 to 360, where 0 is on the positive x-axis (3:00 on a clock)". Nevertheless, what I have observed is that 0 degrees are placed on the west (9:00 on a clock) and the wedge extends counterclockwise (90 degrees placed on 6:00 o clock, 180 placed on 3:00 o clock, 270 placed on 12:00 o clock). To be more precise, the images below depict a part of my region. The first image has a wedge with start angle at 0 degrees and end angle at 90, the second has an angle of 90-180, the third 180-270, and the fourth image has an angle of 270-360 degrees.    • Focal stats is not spreading data out into the neighborhood: it is collecting information from the neighborhood. If you ponder the difference you will see why the images appear to have wedges that are of exactly the opposite orientation. Feb 7, 2015 at 0:09
• I borrow the word "extends" from ArcGIS Help. What I mean is what area contributes for the calculation of the maximum elevation for each processing cell. Feb 7, 2015 at 11:13

Here is a dataset in which one grid cell has a nonzero value, shown as a blue dot: Here is a wedge-shaped neighborhood oriented at 0 degrees north of east, shown in orange: Its left tip is meant to be centered at each point. It represents a collection of displacements relative to the left tip: it is not yet located anywhere in particular.

Let us consider some points within the map. At each one we will construct a neighborhood of this size and shape, such as at this point x: Because this neighborhood includes the blue point, the blue point's value will contribute to the focal statistic at x.

The neighborhood of the next point y does not overlap the blue point. Therefore the value at the blue point does not contribute to the focal statistic at y.

Let's outline all the points like x whose neighborhoods cover the blue point. I show just a few of their neighborhoods (in white). The set of all points whose neighborhoods cover the blue point is also shown in blue: The effect of the blue point has been spread throughout a neighborhood that is the geometric inverse of the original wedge. (In two dimensions it has been rotated by 180 degrees. In three dimensions--when you are doing true 3D analyses--it is rotated and reflected.)

We have merely rediscovered what subtraction means geometrically. If you are still in doubt, here is a rigorous mathematical demonstration of the foregoing. "A" neighborhood is defined to be a set N of displacements (dx,dy). "The" neighborhood of any point (x,y) consists of all points of the form (x,y) + (dx,dy) where (dx,dy) is in N. This particular neighborhood is written N + (x,y).

The inverse of a neighborhood, written -N, is the set of opposite displacements (-dx,-dy) where (dx,dy) is in N.

In any focal operation involving N, a point at location (x0,y0) contributes a value to another point at location (x,y) if and only if (x0,y0) lies within the N neighborhood of (x,y); that is, (x0,y0) lies in N + (x,y). This means there is a displacement (dx,dy) in N for which (x0,y0) = (dx,dy) + (x,y). That is algebraically equivalent to (x,y) = (-dx,-dy) + (x0,y0). But that merely means that (x,y) is in the -N neighborhood of (x0,y0).

These two demonstrations--visual/intuitive, mathematical/rigorous--imply the same thing: When a grid contains prominent values that contribute to focal statistics, those values will appear to be propagated within the -N neighborhood of each prominent value. The visual impression is one of a mosaic of -N neighborhoods: all directions appear to have been reversed.

• Whuber, thank you for your answer! You thing what I get with reversed directions is normal? Feb 8, 2015 at 8:42
• Also, I would like to ask why your wedge is triangular shaped, and not pie-shaped? Feb 8, 2015 at 9:05
• (1) If by "normal" you mean "always happens" then you would be correct. (2) It makes no difference what shape the neighborhood has; I chose triangles to illustrate because they are simple to draw. Crescents would have been even better (because their lack of symmetry would show that the neighborhood really is rotated and not just reflected). Feb 10, 2015 at 13:54